Adding analytics to Django apps

Once you have added your website to Panelbear, all that is left to do is integrate our analytics snippet.

It's a small piece of code that runs on your website, and it collects the metrics necessary to show you the insights in the dashboard. For more information on what it collects check out what we collect.

Install script

Installing the analytics script on your Django project is super simple. All you need to do is:

  1. Go to the settings page for the site.
  2. Copy the snippet shown in the Analytics.js snippet section.
  3. Paste the snippet on your website's base HTML template, preferably at the bottom of the <head> section.

In case you are also handling client side routing changes via React, you can enable SPA mode easily (don't forget to use your own Site ID):

<!-- Panelbear -->
<script async src=""></script>
    window.panelbear = window.panelbear || function() { (window.panelbear.q = window.panelbear.q || []).push(arguments); };
    panelbear('config', {
        site: 'YOUR_SITE_ID',
        spaMode: 'history',
        debug: false,

Check your installation

After you have added our analytics script to the HTML of your website, you should be able to see pageviews show up in the dashboard within a minute of the visitors coming into your website.

Testing your website locally? Check out our local development guide for some tips and tricks.

Mission complete!

Congratulations on completing the integration with Panelbear. That was easy, wasn't it?

Now all that's left to do is to let Panelbear do it's magic over time and you can view the insights in the dashboard.