Google Analytics tracking code not working

I set up a Google Analytics account and I set up a website and get a Google Analytics code that:

<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 inserted all my pages in the title bar, but Analytics continues to say "Tracking not installed."

I looked and checked that the source code is in the header of the main page, and there is code. The site is built on classic ASP (default.asp), and I have several other sites installed in GA, and they worked perfectly. Therefore, I do not know why this does not work. This code was provided by GA.

Can someone tell me why this is not working?

+7
javascript html google-analytics
source share
8 answers

Give it 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 installed this, you can see the analytics in the "Realtime" panel. Many other dashboards may take several days before analytics are visible.

If you use Google Chrome, you can also try ObservePoint Tag Debugger Plugin or Official Google Helper Plugin

+14
source share

Have you tried using a tool like HTTPFox (firefox) Google Analytics Debugger (chrome) to track HTTP requests? This will tell you whether it shoots or not. If so, check the reports in real time as indicated in the comments. If this is not the case, then this is a problem with the code or your page.

+2
source share

I realized what the problem is. I am setting up an account using GA using the new beta feature, and I think that the account will not work with the code that they gave me. So I deleted this account and recreated the classic account and took the code that I posted above and it worked fine. Thank you all for your help!

+1
source share

New analytics means new APIs

You’re using the piece "Universal Analytics", which is the new Google system that they are aiming for. Some of the APIs have been changed, including event tracking.

Make sure you use this:

 ga('send', 'event', category, action, label); 

Instead of this:

 _gaq.push(['_trackEvent', category, action, label]); 

To track events. Here is a detailed blog post on the topic http://blog.tylerbuchea.com/tracking-events-in-googles-new-universal-analytics/

+1
source share

I had a similar problem, I hit the wrong URL, so I redirect somedomain.com to www.somedomain.com

see https://support.google.com/tagmanager/answer/6103683?vid=1-635771588228302150-2080886913&rd=1

Make sure you publish your tag and that your trigger is well-formed so that it can fire on the page you are testing. Note that it may take a few seconds to publish the container, and you must do a hard update (for example, ctrl + F5) of the page to see the changes.

Make sure your trigger is not overly specific. For example, if you define a trigger based on a URL and start the URL with " http://www.example.com ", the tag will not run for the URLs " https://www.example.com " (using " https ") and" http://example.com "(without" www ").

Google Tag Manager can only run tags within the capabilities of the browser. Most browsers will not open more than six to eight HTTP requests to one domain at a time. If you have a large number of tags on one domain running in the same conditions, the tags will only fire within this browser limit.

0
source share

Just stumbled upon a new version of the "no tracking" problem.

Apparently, now with the new Google Site Tag tracking code (gtag.js), Google Analytics will only start tracking if you sign up for Google Tag Manager and enable the domain there.

My new Analytics property was not tracked half a day after adding the tracking code. After turning on the domain in Google Tag Manager, he started tracking instantly.

I think this is probably a mistake. Hope they fix it.

0
source share

In my case, I found that my content blocker (Wipr in Safari) blocked the tracking request. Disabling the content blocker fixed this.

0
source share

add type = "text/javascript"

  <script type="text/javascript" > (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-XXXXXXXX-X', 'auto'); ga('send', 'pageview'); </script> 
-one
source share

All Articles