I want to do some operations if the Google analytics is blocked by the user (may be by the browser).
I am getting a lot of answers here if it is using ga.js, but I am including the analytics.js.
When I tried (typeof ga) = function (always irrespective of Google analytics is blocked or not by the browser. But event is not tracked if it is blocked.)
(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', 'google_analytics_id here', 'auto');
Any help to track whether you are actually calling the analytics.js.
Thank You
I'll have to see the error message, but try replacing it with this updated version.
(function(b, o, i, l, e, r) { b.GoogleAnalyticsObject = l; b[l] || (b[l] = function() { (b[l].q = b[l].q || []).push(arguments) }); b[l].l = +new Date; e = o.createElement(i); r = o.getElementsByTagName(i)[0]; e.src = '//www.google-analytics.com/analytics.js'; r.parentNode.insertBefore(e, r) }(window, document, 'script', 'ga')); ga('create', 'google_analytics_id here'); ga('send', 'pageview');