Skip to main content

Django Google Analytics app allowing for server side/non-js (fork with international url support and User id tracking)tracking.

Project description

forked to patch handling of international urls

Django Google Analytics

Django Google Analytics brings the power of server side/non-js Google Analytics to your Django projects

Installation

  1. Install django-google-analytics-app from PyPI or add to your Python path some other way.

  2. Add google_analytics to you INSTALLED_APPS setting.

  3. Add URL include to your project’s urls.py file:

    (r'^djga/', include('google_analytics.urls')),
  4. Specify a Google Analytics tracking code, i.e.:

    GOOGLE_ANALYTICS = {
        'google_analytics_id': 'xxx',
    }

    where xxx is your tracking code.

  5. If you intend tracking through middleware and Celery remember to install Celery and run its worker process.

Usage

There are two ways to add tracking to your pages.

1. HTML tag

Using <img/> and sticking it in your base.html:

{% load google_analytics_tags %}
<div style="display:none">
    <img src="{% google_analytics %}" width="0" height="0" />
</div>

2. Middleware + Celery

Using Django’s middleware, you can process every request and use Celery to make the request to Google Analytics:

MIDDLEWARE_CLASSES = (
    'google_analytics.middleware.GoogleAnalyticsMiddleware',
)

You have to add google_analytics to your CELERY_IMPORTS:

CELERY_IMPORTS = ('google_analytics.tasks')

You can also specify paths that will be excluded when tracking:

GOOGLE_ANALYTICS_IGNORE_PATH = ['/health/', ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ga-intl-app-4.3.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_ga_intl_app-4.3.1-py2.py3-none-any.whl (11.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-ga-intl-app-4.3.1.tar.gz.

File metadata

  • Download URL: django-ga-intl-app-4.3.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12

File hashes

Hashes for django-ga-intl-app-4.3.1.tar.gz
Algorithm Hash digest
SHA256 c99523ef014cf8c4af699df74057027de3e96313d446636741507e11ae9c6b38
MD5 caee0b76ce9de036d34a5851c1fe66cd
BLAKE2b-256 e6f283439bd16dbc115ee90f9647f69f124e35203a316e3260263aff6e4550cc

See more details on using hashes here.

File details

Details for the file django_ga_intl_app-4.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_ga_intl_app-4.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12

File hashes

Hashes for django_ga_intl_app-4.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 843ececc3bf98182eb4b0d5cdb753946a3959cb69befebafb1fcbab0f43c573d
MD5 1e30340f139e0c5abe590df028114d0f
BLAKE2b-256 2fb3bbee1002f742028954f4319467fe14cd43bca2362e7914a8984a6519bcc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page