Permalink
Browse files

Move Google Analytics import into the <head> section (#138)

* Move Google Analytics import into the <head> section

* Changes to move Google Tag Manager into <head> tag, while leaving the noscript section in the <body> tag.
  • Loading branch information...
rhyven authored and alexandrevicenzi committed Sep 20, 2017
1 parent 0091474 commit 229ad20d36f093d8a6d4526aa67d22d34812ee02
Showing with 13 additions and 8 deletions.
  1. +8 −5 templates/base.html
  2. +0 −3 templates/partial/gtm.html
  3. +5 −0 templates/partial/gtm_noscript.html
View
@@ -36,6 +36,10 @@
<link rel="icon" href="{{ FAVICON }}" type="image/x-icon">
{% endif %}
{% if GOOGLE_ANALYTICS %}
{% include "partial/ga.html" %}
{% endif %}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
@@ -75,10 +79,13 @@
});
</script>
{% endif %}
{% if GOOGLE_TAG_MANAGER %}
{% include "partial/gtm.html" %}
{% endif %}
</head>
<body>
{% if GOOGLE_TAG_MANAGER %}
{% include "partial/gtm.html" %}
{% include "partial/gtm_noscript.html" %}
{% endif %}
<aside>
<div>
@@ -169,10 +176,6 @@ <h1><a href="{{ SITEURL }}">{{ SITETITLE }}</a></h1>
</footer>
</main>
{% if GOOGLE_ANALYTICS %}
{% include "partial/ga.html" %}
{% endif %}
{% if GUAGES %}
{% include "partial/guages.html" %}
{% endif %}
@@ -1,7 +1,4 @@
<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id={{ 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]||[];
@@ -0,0 +1,5 @@
<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id={{ GOOGLE_TAG_MANAGER }}" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager -->

0 comments on commit 229ad20

Please sign in to comment.