Skip to main content

Crazy Egg heatmaps for Django projects.

Project description

The django-crazyegg application integrates Crazy Egg heatmaps into a Django project.

Overview

Crazy Egg is an easy to use hosted web application that generates heatmaps from webpage visitor clicks. It allows you to discover the areas of web pages that are most important to your visitors. This Django application provides template tags that make integration of Crazy Egg very simple.

Installation and configuration

To install django-crazyegg, simply place the django_crazyegg package somewhere on the Python path. The application is configured in the project settings.py file. In order to use the template tags, the django_crazyegg package must be present in the INSTALLED_APPS list:

INSTALLED_APPS = [
    ...
    'django_crazyegg',
    ...
]

You set your Crazy Egg account number in the CRAZYEGG_ACCOUNT_NUMBER setting:

CRAZYEGG_ACCOUNT_NUMBER = '12345678'

Usage

The django-crazyegg application provides two template tags. One to track visitor clicks, and one to register user variables. In order to use the tags in a template, first load the django-crazyegg them by adding {% load crazyegg %} at the top.

Tracking visitor clicks

Crazy Egg uses Javascript to track every visitor click. The track_crazyegg tag inserts the tracking code into the HTML page. The Crazy Egg web pages recommend adding the code directly before the closing </body> HTML tag:

    ...
    {% track_crazyegg %}
</body>
</html>

Even if you only track clicks on a specific page, you can still insert the tracking tag into your base template. The code will only install the Javascript event handler on URLs that you have created snapshots for.

User variables

Crazy Egg can segment clicks based on user variables. If you want to set a user variable, use the set_uservar tag. It takes two arguments: the variable number (between 1 and 5) and the value (a string). The tag must come after the tracking code, and can be used multiple times:

    ...
    {% track_crazyegg %}
    {% set_uservar 1 "some string" %}
    {% set_uservar 2 some_context_variable %}
</body>
</html>

Changelog

1.0.0

Project created from code used in the IPv6 Ready project.

1.0.1

Fixed links to the Github project pages in the setup.py script.

2.0.0

Added the set_uservar template tag to set Crazy Egg user variables. These can be used to segment clicks on the confetti and layout views.

Because variables can only be set after the tracking code has been loaded, the tracking template tag has been reverted to the code that Crazy Egg recommends and is no longer asynchronous.


django-crazyegg was written by Joost Cassee <joost@cassee.net>

Development was made possible by Bateau Knowledge. Thanks go to Crazy Egg for their support.

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-crazyegg-2.0.0.tar.gz (5.9 kB view hashes)

Uploaded Source

Supported by

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