Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Simple Google Analytics integration for Django.

Project Description

# django-ganalytics

Simple Google Analytics integration for Django.

## Meta

* author: Randall Degges
* email:
* status: maintained, in development

[![Build Status](](

## Purpose

Honestly, all the other Google Analytics Django apps suck. All I want to do is
put my Google Analytics code in my ```` file, and use a simple
template tag to render the Google Analytics asynchronous javascript code,

Unfortunately, all the existing solutions don't do this, and that pisses me


## Installation and Usage

Anyway, let's install this bitch! The first thing you'll want to do is run:

``` bash
$ pip install django-ganalytics

Next, modify your ```` file, and add your Google Analytics code
(usually something like ``UA-XXXXXXXX-XX``), as well as put
``ganalytics`` in your ``INSTALLED_APPS``:

``` python

# ...


Now, to actually render your Google Analytics asynchronous javascript code,
edit your desired Django template (I like to do this in my ``base.html``
template), and add the following:

``` html
{% load ganalytics %}
<!--- ... -->

{% ganalytics %}

<!--- ... -->

When Django processes your template, it'll replace ``{% ganalytics %}``

``` html
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', '{{ GANALYTICS_TRACKING_CODE }}', 'auto');
ga('send', 'pageview');

Easy, right?

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.2 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Oct 19, 2017
(26.2 kB) Copy SHA256 Hash SHA256
Source None Oct 19, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate