Skip to content

Commit

Permalink
Merge pull request #9 from hello-jason/tag-manager-container
Browse files Browse the repository at this point in the history
Switches GA with Tag manager, for #8
  • Loading branch information
hello-jason authored Sep 10, 2022
2 parents 2d07642 + 49ad7f6 commit c18c7f0
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/_layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
}
</script>

{# Google Analytics #}
{# Google Tag Manager #}
{% if env.isProd %}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48926813-1', 'auto');
ga('send', 'pageview');
ga('set', 'anonymizeIp', true);
</script>
<!-- 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-KFL2NCD');</script>
<!-- End Google Tag Manager -->
{% endif %}

{# Check frontmatter for redirect command #}
Expand All @@ -41,6 +39,13 @@
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;700&display=swap" rel="stylesheet">
</head>
<body class="bg-primary-400 text-black selection:bg-secondary selection:text-white page-{{ title | lower | replace(" ", "-") }} layout-{{ layout }}">

{# Google Tag Manager (noscript) #}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KFL2NCD"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

<a href="#main" class="skip-link">Skip to main content</a>

{# Hero #}
Expand Down

0 comments on commit c18c7f0

Please sign in to comment.