Google Analytics Tracking Code is Not Working
google-analytics, html, javascript
Solution
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
Problem
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?