Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Add GTM instead of GA
Browse files Browse the repository at this point in the history
  • Loading branch information
osamajandali committed Jul 10, 2023
1 parent 06e3c50 commit 8dfd26d
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,18 @@ const { title, description, image } = metaData
/>
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content={`${baseURL}${image}`} />

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-4X7F9S319R"
></script>
<!-- Google Tag Manager -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
// @ts-ignore: Unreachable code error
dataLayer.push(arguments);
}
// @ts-ignore: Unreachable code error
gtag("js", new Date());
// @ts-ignore: Unreachable code error
gtag("config", "G-4X7F9S319R");
(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-5ZDW8XX");
</script>
<!-- End Google Tag Manager -->
</head>
Expand Down Expand Up @@ -105,5 +103,14 @@ const { title, description, image } = metaData
box-shadow: 0 0 0 3px rgb(174 204 83 / 50%);
}
</style>
<!-- Google Tag Manager (noscript) -->
<noscript
><iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-5ZDW8XX"
height="0"
width="0"
style="display:none;visibility:hidden"></iframe></noscript
>
<!-- End Google Tag Manager (noscript) -->
</body>
</html>

0 comments on commit 8dfd26d

Please sign in to comment.