Add support for Google Tag Manager

Add support for Google Tag Manager tracking code into the included
themes and the configuration template.
This commit is contained in:
brent.bb
2016-09-26 22:27:43 -04:00
parent 8de51c1f37
commit 1659876046
5 changed files with 17 additions and 0 deletions

View File

@@ -171,6 +171,9 @@ ignore_files = []
# Google Analytics tracking code (UA-xxxx-x)
# google_analytics = ''
# Google Tag Manager tracking code (GTM-xxxxxx)
# google_tag_manager = ''
# Piwik tracking
# tracker_url must not contain trailing slash.
# Example : {'tracker_url': 'http://stats.domain.com', 'site_id' : 2}

View File

@@ -20,6 +20,7 @@
{% endblock %}
</head>
<body>
{% include 'gtm.html' %}
<div class="container">
<div class="four columns">
<div class="sidebar">

View File

@@ -0,0 +1,11 @@
{% if settings.google_tag_manager %}
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id={{settings.google_tag_manager}}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{settings.google_tag_manager}}');</script>
<!-- End Google Tag Manager -->
{% endif %}

View File

@@ -29,6 +29,7 @@
{% endif %}
</head>
<body>
{% include 'gtm.html' %}
<div class="container">
<header>
<h1><a href="{{ album.index_url }}">{{ index_title }}</a></h1>

View File

@@ -16,6 +16,7 @@
{% endblock %}
</head>
<body>
{% include 'gtm.html' %}
<div class="container">
<h1><a href="{{ album.index_url }}">{{ index_title }}</a></h1>