Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics GIF request not sent

I'm having some troubles setting up Google Analytics. I downloaded the Google Analytics Debugging extension for Chrome and if I take a look at the console, the __utm.gif request is never sent. I triple-checked my code, and everything is fine. The debugging version of ga.js is downloaded properly. In fact, I have the exact same problem as this guy that never got an answer...

For the sake of it, here is my tracking code (with UA-########-# properly replaced in my original code, of course)

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-########-#']);
_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);
})();

Everything is set up properly, and here is what I get in the console output :

_gaq.push processing : "[_setAccount, UA-########-#]"
_gaq.push processing : "[_trackPageview]"
Track Pageview

And then nothing else. I tried with a colleague's personal website that I know has Google Analytics installed and I can see the request for the .gif file.

Anyone ever had this problem ?

like image 326
marco-fiset Avatar asked Mar 16 '12 14:03

marco-fiset


2 Answers

Are you testing your site on localhost or an intranet? If so, you may need to add

_gaq.push(['_setDomainName', 'none']);

before _trackPageview

See Google Analytics on Intranets and Development Servers for more info...

If you’re using Google Analytics on a site with a URL like http://intranet/ or something like http://mydevserver:12345 it won’t work.

Specifically, the Google Analytics JS code will not send the tracking hit (__utm.gif) to the GA servers.

I don’t really know the specifics, but I’m guessing that the domain hashing code looks for at least one period in the hostname and won’t work if it doesn’t find one.

like image 195
mike Avatar answered Nov 19 '22 15:11

mike


If you are not receiving the Tracking beacon sent! message then it could be one of the following:

  • A problem with Cookie settings in your browser (however unlikely in your case)
  • An issue with your proxy/firewall (can you check fiddler or your Network tab and see if any of your resources were 404'd?)
  • A javascript error (anything else at all in your console?)

Hope this helps you debug your situation. I'll update this answer if you provide any more information.

UPDATE

It may help to make sure that the issue is with the Chrome Analytics debugger plugin versus your analytics setup. To do this, open something like Fiddler or in Chrome under Resources - Frames - (page) - Images. You should see the request for __utm.gif there. If you do not, its an issue with your Analytics setup. If you do, its just an issue with the Chrome Analytics debugger.

To answer your question though, I've only seen something similar happen one other time and that was on a site with Google Ads. I received an Unsafe Javascript attempt to access frame with URL... error.

like image 2
shanabus Avatar answered Nov 19 '22 16:11

shanabus