Clicky – traffic analysis

Clicky is an online web analytics tool. It is similar to Google Analytics in that it provides statistics on who is visiting your website and what they are doing. Clicky provides its data in real time and is designed to be very easy to use.

Installation

To start using the Clicky integration, you must have installed the django-analytical package and have added the analytical application to INSTALLED_APPS in your project settings.py file. See Installation and configuration for details.

Next you need to add the Clicky template tag to your templates. This step is only needed if you are not using the generic analytical.* tags. If you are, skip to Configuration.

The Clicky tracking code is inserted into templates using a template tag. Load the clicky template tag library and insert the clicky tag. Because every page that you want to track must have the tag, it is useful to add it to your base template. Insert the tag at the bottom of the HTML body:

{% load clicky %}
...
{% clicky %}
</body>
</html>

Configuration

Before you can use the Clicky integration, you must first set your website Site ID. You can also customize the data that Clicky tracks.

Setting the Site ID

Every website you track with Clicky gets its own Site ID, and the clicky tag will include it in the rendered Javascript code. You can find the Site ID in the Info tab of the website Preferences page, in your Clicky account. Set CLICKY_SITE_ID in the project settings.py file:

CLICKY_SITE_ID = 'XXXXXXXX'

If you do not set a Site ID, the tracking code will not be rendered.

Internal IP addresses

Usually you do not want to track clicks from your development or internal IP addresses. By default, if the tags detect that the client comes from any address in the CLICKY_INTERNAL_IPS setting, the tracking code is commented out. It takes the value of ANALYTICAL_INTERNAL_IPS by default (which in turn is INTERNAL_IPS by default). See Identifying authenticated users for important information about detecting the visitor IP address.

Custom data

As described in the Clicky customized tracking documentation page, the data that is tracked by Clicky can be customized by setting the clicky_custom Javascript variable before loading the tracking code. Using template context variables, you can let the clicky tag pass custom data to Clicky automatically. You can set the context variables in your view when you render a template containing the tracking code:

context = RequestContext({'clicky_title': 'A better page title'})
return some_template.render(context)

It is annoying to do this for every view, so you may want to set custom properties in a context processor that you add to the TEMPLATE_CONTEXT_PROCESSORS list in settings.py:

def clicky_global_properties(request):
    return {'clicky_timeout': 10}

Just remember that if you set the same context variable in the RequestContext constructor and in a context processor, the latter clobbers the former.

Here is a table with the most important variables. All variables listed on the customized tracking documentation page can be set by replacing clicky_custom. with clicky_.

Context variable Clicky property Description
clicky_session session Session data. A dictionary containing username and/or group keys.
clicky_goal goal A succeeded goal. A dictionary containing id and optionally revenue keys.
clicky_split split Split testing page version. A dictionary containing name, version and optionally goal keys.
clicky_href href The URL as tracked by Clicky. Default is the page URL.
clicky_title title The page title as tracked by Clicky. Default is the HTML title.

Identifying authenticated users

If you have not set the session property explicitly, the username of an authenticated user is passed to Clicky automatically. See Identifying authenticated users.


Thanks go to Clicky for their support with the development of this application.