Skip to content

Commit 06b0321

Browse files
committed
feat: add gtm
1 parent e30fbcd commit 06b0321

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/components/BaseHead.astro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site);
1313
1414
const { title } = Astro.props;
1515
---
16+
<!-- Google Tag Manager -->
17+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
18+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
19+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
20+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
21+
})(window,document,'script','dataLayer','GTM-NNS54X6T');</script>
22+
<!-- End Google Tag Manager -->
1623

1724
<!-- Global Metadata -->
1825
<meta charset="utf-8" />

src/components/Header.astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
import { SITE_TITLE } from '../consts';
33
---
4+
<!-- Google Tag Manager (noscript) -->
5+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NNS54X6T"
6+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
7+
<!-- End Google Tag Manager (noscript) -->
48

59
<header class="bg-black border-b border-fuchsia-500/20">
610
<nav class="container mx-auto px-4 py-4 flex justify-center items-center">

0 commit comments

Comments
 (0)