Set up Flowsery Analytics in a Django project
This guide covers adding Flowsery Analytics tracking to your Django application.
Insert the tracking snippet in your base template
The simplest way to load the script on every page is through Django's base template.
-
Open your base template -- typically at
templates/base.html. -
Place the Flowsery Analytics snippet inside the
<head>block:<script defer data-fl-website-id="flid_******" data-domain="your_domain.com" src="https://analytics.flowsery.com/js/script.js" ></script>Replace
flid_******with the Website ID from your Flowsery Analytics settings. Replaceyour_domain.comwith the root domain of your site.
Alternative: Drive values from Django settings
For a more flexible setup, store the tracking values in settings.py:
-
Add the following to
settings.py:FLOWSERY_WEBSITE_ID = 'flid_******' FLOWSERY_DOMAIN = 'your_domain.com' -
Reference these values in your base template:
<script defer data-fl-website-id="{{ settings.FLOWSERY_WEBSITE_ID }}" data-domain="{{ settings.FLOWSERY_DOMAIN }}" src="https://analytics.flowsery.com/js/script.js" ></script>
Confirm everything is working
After deploying either approach:
- Navigate to your live site
- Open your Flowsery Analytics dashboard and check for incoming pageviews
- Allow a couple of minutes for the first data to appear
For additional options such as localhost tracking, custom API endpoints, or cross-domain configuration, refer to the script configuration reference.