Skip to content

Commit

Permalink
set id on script block for analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Jul 1, 2024
1 parent c46618c commit fe1ff09
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,33 @@
<link href="manifest.webmanifest" rel="manifest" />
<link rel="apple-touch-icon" sizes="512x512" href="icon-512.png" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P8SCP5YFBJ"></script>
<script>
var siteTag = null;
var gtagId = null;

if(location.hostname === "bogle.tools") {
siteTag = 'G-P8SCP5YFBJ';
gtagId = 'G-P8SCP5YFBJ';
}
else if (location.hostname === "multifol.io")
{
siteTag = 'G-G2DBGS5RWK';
gtagId = 'G-G2DBGS5RWK';
}

if (siteTag !== null) {
if (gtagId !== null) {
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', siteTag);
gtag('config', gtagId);
}

var gtagScriptExists = false;
if (!gtagScriptExists) {
var script = document.createElement("script");
script.type = "text/javascript";
script.async = true;
script.src = "//www.googletagmanager.com/gtag/js?id=" + gtagId;
document.getElementsByTagName("head")[0].appendChild(script);
gtagScriptExists = true;
}
</script>
<script>
Expand Down

0 comments on commit fe1ff09

Please sign in to comment.