简体   繁体   中英

Google Analytics is not tracking in real time?

Hi I have this snippet of GA code and it seems to be working fine however, it doesn't seem to be updating in real time? I have to update it to make the real time reporting work for placement.

Does anyone have an explanation as to why this is happening?

    (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-21324070-1', 'example.co.uk');
    ga('send', 'pageview');

Google analytics is not updated in real-time nor the webmasters tool(as a side note). Generally GA gets updated every day for the previous day to update and WT 3 days. Additionally, you can still go to google analytics console and there's a section called 'real time' which will tell you about what's happening on the site 'right now'.

I got this issue fixed myself, apparently it have something to do with the Universal Google Analytics code so I switched it back to the old one using the ga.js file.

Here's my code now and it works fine

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40584070-1']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM