Permalink
Browse files

Merge pull request #302 from bartekpl/fix-gtm

Fix GTM implementation as per current Google's guidelines
  • Loading branch information...
2 parents cf6b570 + 0f3b8dd commit 16c0c723fff6e0f6ff99e59691a79be7a2b4d453 @johnotander committed on GitHub Nov 14, 2016
Showing with 11 additions and 14 deletions.
  1. +7 −0 _includes/head.html
  2. +2 −7 _layouts/center.html
  3. +2 −7 _layouts/default.html
View
@@ -1,4 +1,11 @@
<head>
+ {% if site.google_tag_manager %}
+ <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=
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+ })(window,document,'script','dataLayer','{{ site.google_tag_manager }}');</script>
+ {% endif %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% if page.title %}{{ page.title | strip_html }} &#8211; {% endif %}{{ site.title | strip_html }}</title>
@@ -3,13 +3,8 @@
{% include head.html %}
<body class="site{% if site.animated %} animated fade-in-down{% endif %}">
{% if site.google_tag_manager %}
- <noscript><iframe src="//www.googletagmanager.com/ns.html?id={{ site.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','{{ site.google_tag_manager }}');</script>
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ site.google_tag_manager }}"
+height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{% endif %}
<div class="site-wrap center">
{% include header.html %}
@@ -3,13 +3,8 @@
{% include head.html %}
<body class="site{% if site.animated %} animated fade-in-down{% endif %}">
{% if site.google_tag_manager %}
- <noscript><iframe src="//www.googletagmanager.com/ns.html?id={{ site.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','{{ site.google_tag_manager }}');</script>
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ site.google_tag_manager }}"
+height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{% endif %}
{% if site.facebook_comments %}
<div id="fb-root"></div>

0 comments on commit 16c0c72

Please sign in to comment.