: Google Analytics not working - Non-standard implementation in Google Tag Assistant I've pasted the following code immediately after the tag on my layout pages (using ASP.NET MCV Razor layouts,
I've pasted the following code immediately after the tag on my layout pages (using ASP.NET MCV Razor layouts, but that wouldn't have an effect, would it?):
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111111111-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('config', 'UA-111111111-1');
</script>
This is exactly how it appears in the Google Analytics portal, except obviously that's not the real ID.
This code is the very first thing after the head tag, before even the meta tags, although I just read that that's probably not a good idea: stackoverflow.com/questions/1987065/what-are-best-practices-to-order-elements-in-head
Google Tag Assistant says I have a non-standard implementation, and the portal has sent me an alert stating that I'm not getting any hits, even though I know I am, and I've used the portal to send test traffic also.
I've got two IP filters on that exclude traffic, which shouldn't matter, and a filter to only look at traffic to the live domain (I've got a duplicate site on another domain for testing that uses the same code base).
The only other thing I can think of is because this site is hosted on Azure, even though I've configured a custom domain, maybe I'm getting no traffic because Google Analytics is seeing the mywebsite.azurewebsites.net domain rather than the custom domain, and the filter is for the custom domain? But that would be a bit odd.
The site has had the analytics code in it for about three days now.
What am I doing wrong?
More posts by @Holmes151
2 Comments
Sorted by latest first Latest Oldest Best
Google Analytics has introduced a new tracking code snippet Global Site Tag gtag.js
Last I did some testing with it, Google Tag Assistant had not been updated yet to correctly recognize the new snippet.
As of yesterday, the new tracking code was causing GTA to show a missing/invalid tag id for the GTM tag (even though GTM itself is not installed)
and a non-standard implementation msg for the GA tracking.
Which is why the OP is getting borked messages from Google Tag Assistant regarding the tracking code installation.
The new snippet calls some GTM code that is associated with your GA tracking ID (rather than a GTM container code) and bundles Universal analytics.js within it too, also associated with your GA tracking id.
Hopefully Google will update GTA to take the new code syntax into account sooner rather than later.
The OP will keep getting the non-standard implementation message until Google updates Google Tag Assistant to properly recognize the new Global Site Tag gtag.js tracking snippet.
The filter was: include only traffic to the hostname that are equal to example.com.
Since my site uses www, this didn't work, because the hostname included www in this case.
Should have read this list of custom filter fields first, which defined exactly what they meant by hostname (a URL hostname): support.google.com/analytics/answer/1034380?hl=en
Also see here: www.gilliganondata.com/index.php/2012/05/22/the-anatomy-of-a-url-protocol-hostname-path-and-parameters/
Changed the filter to: include only traffic to the hostname that contain example.com.
Now it works, I can see traffic.
Although Google Tag Assistant is still giving me the non-standard implementation warning. Others have said it's buggy, I don't know, will try to fix later.
Update: Putting the Analytics code snippet at the end of the <head> tag instead of at the start makes no difference. Still getting Non-standard implementation.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.