django-privacy-killer - Template tags for including tracker codes

Version 0.3

This module allows specifying tracking codes through settings (and therefore through the environment). It currently supports Google Tag Manager and Google Analytics tracking codes, but pull requests for adding support for additional trackers is very welcome!

Usage variant 1

  • Install the module using pip install django-privacy-killer
  • Add privacy_killer to INSTALLED_APPS and add the list of tracking IDS to your settings as PRIVACY_KILLER_IDS = ['GTM-****', 'UA-****', ...] (Note! This is a stupid example – specifying both GTM and UA codes is probably not what you want
  • Load the template tag library ({% load privacy_killer %}) and add the two tags, {% privacy_killer_head %} near the <head> of your site, and {% privacy_killer_body %} near the <body> element.

Usage variant 2

Do not use this module, and also do not use any trackers at all.

Supported trackers

  • Google Tag Manager (GTM-****)
  • Google Universal Analytics (UA-****)
  • Facebook Pixel (Prefix the **** code with FBQ- when specifying PRIVACY_KILLER_IDS)

Change log

0.3 (2019-10-21)

  • Added support for the Facebook tracking pixel.

0.2 (2019-06-12)

  • Changed the Google Analytics snippet to always anonymize IPs by default.
  • Dropped compatibility with Python 2.
  • Added Django 2.1, 2.2 and Django 3.0 to the matrix.
  • Reformatted the code using black.

0.1 (2017-08-29)

  • Initial public version.