> For the complete documentation index, see [llms.txt](https://docs.humblytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humblytics.com/how-to-get-started/django.md).

# Django

Add Humblytics to your Django site in about 5 minutes.

{% hint style="info" %}
**You need:** access to your base template and a production deploy. `localhost` won't verify.
{% endhint %}

## 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:

```django
{% 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.

<figure><img src="https://1281224403-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqZMBn2D7F1lV2hgGTS2X%2Fuploads%2FsQRHdaMtK6sUwA0lxuJw%2Fcustom%20code%20script.gif?alt=media&amp;token=670adf7b-a09d-4d95-888d-848e32016dca" alt=""><figcaption></figcaption></figure>

## 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](/how-to-get-started/verify-and-troubleshoot-tracking.md).
