Django Privacy Analytics is a minimalist, performant, and privacy-focused analytics system that runs in your Django app.
Django Privacy Analytics fully respects the 'Do Not Track' (DNT) header; if a request has DNT enabled, Django Privacy Analytics will not store a page view.
- Install Django Privacy Analytics by running
pip install django-privacy-analytics
or addingdjango-privacy-analytics
to yourrequirements.txt
- Add
privacy_analytics
to yourINSTALLED_APPS
setting. - Ensure
django.contrib.humanize
is in yourINSTALLED_APPS
. - Add
privacy_analytics.middleware.AnalyticsMiddleware
to yourMIDDLEWARE
setting, ideally somewhere towards the end (and afterAuthenticationMiddleware
). - Create the new necessary models by running
python3 manage.py migrate
. - Optionally add a place to view the analytics by adding
path('analytics/', include('privacy_analytics.urls'))
to your URL routing configuration.
Analyics dashboard can be controlled by user permissions with the PermissionsRequiredMixin
In settings.py
, you can set the following:
ANALYTICS_IGNORE_PATHS
: ignore requests whose paths start with members of this list