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