Hotjar is a website analytics and user feedback tool.
To start using the Hotjar 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 ../install
for details.
Next you need to add the Hotjar template tag to your templates. This step is only needed if you are not using the generic analytical.*
tags. If you are, skip to hotjar-configuration
.
The Hotjar code is inserted into templates using template tags. Because every page that you want to track must have the tag, it is useful to add it to your base template. At the top of the template, load the hotjar
template tag library. Then insert the hotjar
tag at the bottom of the head section:
{% load hotjar %}
<html>
<head>
...
{% hotjar %}
</head>
...
</html>
Before you can use the Hotjar integration, you must first set your Site ID.
You can find the Hotjar Site ID in the "Sites & Organizations" section of your Hotjar account. Set HOTJAR_SITE_ID
in the project settings.py
file:
HOTJAR_SITE_ID = 'XXXXXXXXX'
If you do not set a Hotjar Site ID, the code will not be rendered.
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 HOTJAR_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-visitors
for important information about detecting the visitor IP address.