Skip to content

Commit

Permalink
Add google tag manager scripts (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldon-b authored Oct 28, 2024
1 parent 7a754c2 commit 8d8e6dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
10 changes: 10 additions & 0 deletions _includes/core/google-tag-manager-noscript.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-TDPGWXJG"
height="0"
width="0"
style="display: none; visibility: hidden"
></iframe
></noscript>
<!-- End Google Tag Manager (noscript) -->
14 changes: 14 additions & 0 deletions _includes/core/google-tag-manager-script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- 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", "GTM-TDPGWXJG");
</script>
<!-- End Google Tag Manager -->
5 changes: 3 additions & 2 deletions _layouts/base.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<!doctype html>
<html lang="{{ page.lang | default: 'en-US' }}">
<head>
{% include core/meta.html %} {% include core/css.html %}
{% include core/google-tag-manager-script.html %} {% include core/meta.html
%} {% include core/css.html %}
</head>

<body
class="{{ layout.body.class }} {{ page.body.class }} lang-{{ page.lang }}"
>
{{ content }}
{% include core/google-tag-manager-noscript.html %} {{ content }}
</body>
</html>

0 comments on commit 8d8e6dd

Please sign in to comment.