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


  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 file:

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

        '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.


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" />

2. Middleware + Celery

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


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:


Project details

Download files

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

Files for django-ga-intl-app, version 4.3.1
Filename, size File type Python version Upload date Hashes
Filename, size django_ga_intl_app-4.3.1-py2.py3-none-any.whl (11.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-ga-intl-app-4.3.1.tar.gz (10.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page