Add Google Tag Manager to your Aldryn and django CMS projects
Python HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.tx
aldryn_google_tag_manager
LICENSE.txt
MANIFEST.in
README.rst
addon.json
aldryn_config.py
setup.py

README.rst

Aldryn Google Tag Manager

Aldryn Google Tag Manager provides an easy-to-use Google Tag Manager template tag for your Aldryn and django CMS projects.

A tag is snippet of JavaScript that sends information to a third party, such as Google. If you don't use a tag management solution such as Google Tag Manager, you need to add these snippets of JavaScript directly to the source code of your site. In contrast, with Google Tag Manager, you no longer need to maintain each of these JavaScript snippets in your source code; instead, you specify the tags that you want to fire, and when you want them to fire, in the Google Tag Manager user interface.

Aldryn Google Tag Manager makes this available for your django CMS project - provide the Google Tag Manager ID for this site, and it will do the rest.

At the top of your template, add:

{% load google_tag_manager_tags %}

And immediately after the <body> tag (if you're using Aldryn, then just after the {% block extend_root %} in your projects's base.html template):

{% google_tag_manager YOUR_TAG_ID %}

If you've already set GOOGLE_TAG_MANAGER_ID in your settings, or configured it in the Aldryn Control Panel, just use:

{% google_tag_manager %}