Crazy Egg is an easy to use hosted web application that generatesheatmaps from webpage visitor clicks. It allows you to discover theareas of web pages that are most important to your visitors. ThisDjango application provides template tags that make integration ofCrazy 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 inthe 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 trackvisitor clicks, and one to register user variables. In order to use thetags in a template, first load the django-crazyegg template library byadding ``{% load crazyegg %}`` at the top.

Versions of django-crazyegg prior to 2.0.0 used asynchronous loading to allow the tag to be added to the HTML head section. Unfortunately, that caused problems if you wanted to set user variables (see below).

Even if you only track clicks on a specific page, you can still insertthe tracking tag into your base template. The code will only installthe Javascript event handler on URLs that you have created snapshotsfor.

Often you do not want to track clicks from your development or internalIP addresses. For this reason you can set the ``CRAZYEGG_INTERNAL_IPS``to a list or tuple of addresses that the template tag will not berendered on::

CRAZYEGG_INTERNAL_IPS = ['192.168.45.2', '192.168.45.5']

If you already use the ``INTERNAL_IPS`` setting, you could set theCrazy Egg internal addreses to this value. This will be the defaultfrom version 3.0.0 upwards.

.. note::

The template tag can only access the visitor IP address if the HTTP request is present in the template context as the ``request`` variable. For this reason, the ``CRAZYEGG_INTERNAL_IPS`` settings only works if you add this variable to the context yourself when you render the template, or you use the ``RequestContext`` and add the ``django.core.context_processors.request`` context processor to the ``TEMPLATE_CONTEXT_PROCESSORS`` setting::

Crazy Egg can segment clicks based on `user variables`_. If you want toset a user variable, use the ``set_uservar`` tag. It takes twoarguments: the variable number (between 1 and 5) and the value (astring). The tag must come after the tracking code, and can be usedmultiple times::