Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

ASP.net Google analytics tag not working

Hi

I am trying to get Google analytics to work with my ASP.net website. I was told to put the code below into the <head> section of every page, but as I use a Site.Master which has the <head> section, I only put it there. When I tested the connection on Google it didn't work. How do I solve this?
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-20xxx541-1">
</script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-20xx541-1');
</script>

Open in new window

ASP.NETGoogleAnalytics

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon