I am trying to setup Google Analytics on my site, however it will not detect that it is being tracked.
I have placed the code they provided in my header.php right before the </head>
as recommended:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-41420598-1', 'example.com');
ga('send', 'pageview');
</script>
Not really sure what else to do..
It took a day or two after I put the tracking code on each of my pages for the status on my Google Analytics Tracking Info tab to be updated from "Tracking Not Installed" to "Universal Analytics is enabled for this property". During this time I was seeing regular activity in my tracking reports.
If you're brand new to Google Analytics, the default reports only include data up to the previous day. If you want to check for activity on the same day that you added the tracking code, you have to adjust the date range to include the current day's activity.
That's their new tracking code, I wouldn't be surprised if their detector isn't set up to find it yet. Go into the Google Analytics real-time dashboard and see if your pageviews are showing up - if they are, don't worry about the incorrect flagging.
I fix this by using the asynchronous script first, then visiting a page on the site, refreshing the GA screen to check if the status has been changed, then replacing the GA script with the Universal script once the status has been updated. It works every time. It makes my clients happy.