For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Django

Add Humblytics to your Django site in about 5 minutes.

You need: access to your base template and a production deploy. localhost won't verify.

1. Copy your tracking code

In Humblytics, open Site settings → Install and click Copy tracking code.

2. Add it to your base template

Paste the snippet just before </head> in the template every page extends, usually templates/base.html. Pages that use {% extends "base.html" %} get it automatically.

Only want it in production? Wrap the snippet in a check, for example:

{% if not debug %}
  <!-- paste your Humblytics snippet here -->
{% endif %}

The debug variable needs django.template.context_processors.debug in your settings and your server IP in INTERNAL_IPS. Or pass your own flag through a context processor.

3. Deploy and verify

  1. Deploy to production.

  2. Back in Humblytics, click Verify install.

  3. Open your live site in a private window and click around. Your visit appears in Observe → Analytics → Overview under Live Activity within about a minute.

Not verifying?

  • Every page extends the template with the snippet. Pages with their own <head> need it too.

  • Using django-csp? Allow https://app.humblytics.com in script-src and connect-src, and allow the inline script (with a nonce).

Still stuck? See Verify & Troubleshoot Tracking.

Last updated