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>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments)};
  gtag('js', new Date());

  gtag('config', 'UA-111111111-1');

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: https://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?

  • support.google.com/tagassistant/answer/… nonstandard implementation means that the tag assistant doesn't see the snippet in the page even though it detects that some data is being collected. Commented Sep 30, 2017 at 8:26
  • @StephenOstermiller I'm not using Tag Manager, just Analytics, this is the exact link Tag Assistant suggested: support.google.com/tagassistant/answer/…. But the code is in the page, I've checked it in View Source, and it's exactly the same as the code snippet I'm supposed to use. Some documentation says put the snippet as the final thing in the <head>, I've got it as the first thing, maybe I'll try that and see if it makes any difference. Not sure why it's not working.
    – nmit026
    Commented Sep 30, 2017 at 10:22

2 Answers 2


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.

  • upvoted! i have included the exact same file as the OP and I have a doubt if you dont mind answering, wasnt there something called google analytics ga.js. The code for it looked similar to the bottom script here github.com/sahat/hackathon-starter/blob/master/views/layout.pug We dont need this anymore, Is Google Tag Manager inclusive of Google analytics or they both separate, very confused newbie here and some guidance is super appreciated
    – PirateApp
    Commented Aug 9, 2019 at 5:12
  • 1
    Maybe starting your own thread with questions to your own specific situation would be more helpful rather than hijacking someone elses thread via the comments. The page you linked to, the bottom script is Univeral analytics.js. ga.js is now considered legacy code and while it will track it does not support a number of the newer analytics tracking functionality, nor is it updated to support new features/functionality. You can find the dev docs for ga.js on the google dev site
    – Bronwyn V
    Commented Aug 9, 2019 at 14:25

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): https://support.google.com/analytics/answer/1034380?hl=en

Also see here: http://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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.