Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Tracking Code is Not Working

I setup a Google Analytics account and I setup the website and got the Analytics code which is:

 <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-4XXXXXXX-1', 'mydomain.com');
      ga('send', 'pageview');
 </script>

I pasted into the Header of all my pages but Analytics keeps saying "Tracking Not Installed".

I viewed and verified the source code is within the header of the home page and the code is there. The site is built on Classic ASP (default.asp) and I have several other sites setup in GA and they worked fine. So I don't know why this isn't working. The code above was provided by GA.

Can someone please tell me why this isn't working?

like image 493
Frank G. Avatar asked Nov 22 '13 03:11

Frank G.


3 Answers

Give this a try.

<script>
    var _gaq = _gaq || [];  
    _gaq.push(['_setAccount', 'UA-4XXXXXXX-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);
    })();
</script>

If you just set this up, you should be able to see analytics in the "Realtime" panel. Many of the other panels can take over a day before analytics are visible.

If you're using Google Chrome, you might also try the tag debugger plugin by ObservePoint or the Official Tag assistant plugin by Google

like image 120
Cody Bonney Avatar answered Oct 21 '22 08:10

Cody Bonney


Have you tried using a tool like HTTPFox (firefox) Google's Google Analytics Debugger (chrome) to monitor http requests? This will tell you if it's firing or not. If it is, check the real-time reports as mentioned in the comments. If it's not, then it's an issue with the code or your page.

like image 25
Blexy Avatar answered Oct 21 '22 09:10

Blexy


I figured out what the problem was. I setup an Account with GA using there new Beta Feature and I guess the account wouldn't work with the code they gave me. So I deleted that account and recreated a Classic Account and took the code I posted above and it worked fine. Thank you all for your help!!

like image 1
Frank G. Avatar answered Oct 21 '22 09:10

Frank G.