Add Google Tag Manager Integration (#157)
This commit is contained in:
parent
cef600c9fe
commit
09e037d535
@ -95,6 +95,9 @@ url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
|
||||
# Fill in your Google Analytics ID to track your website using GA
|
||||
#google_analytics: ""
|
||||
|
||||
# Google Tag Manager ID
|
||||
#gtm: ""
|
||||
|
||||
# Facebook App ID
|
||||
# fb_app_id: ""
|
||||
|
||||
|
6
_includes/gtm_body.html
Normal file
6
_includes/gtm_body.html
Normal file
@ -0,0 +1,6 @@
|
||||
{% if site.gtm %}
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ site.gtm }}"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
{% endif %}
|
9
_includes/gtm_head.html
Normal file
9
_includes/gtm_head.html
Normal file
@ -0,0 +1,9 @@
|
||||
{% if site.gtm %}
|
||||
<!-- 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.gtm }}');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
{% endif %}
|
@ -13,6 +13,8 @@
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ site.title }} {{ site.title-separator }} {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
|
||||
|
||||
{% include gtm_head.html %}
|
||||
|
||||
{% if layout.common-ext-css %}
|
||||
{% for css in layout.common-ext-css %}
|
||||
<link rel="stylesheet" href="{{ css }}" />
|
||||
|
@ -21,6 +21,8 @@ common-js:
|
||||
|
||||
<body>
|
||||
|
||||
{% include gtm_body.html %}
|
||||
|
||||
{% include nav.html %}
|
||||
|
||||
{{ content }}
|
||||
|
Loading…
Reference in New Issue
Block a user