Welcome to WebmasterWorld Guest from 54.167.157.247

Forum Moderators: open

Message Too Old, No Replies

Google Analytics code and 404

404 problems with Google Analytics code

   
7:08 am on Nov 10, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I've been having GA in some of my sites for quite a bit. I used both old and new code.

In both cases, I have always been getting 404 as client would try to load ga.js script from the local server, rather then from Google’s site where the client is supposed to go.

I thought about downloading the script and have it as local on my server, but I saw a lot of content and links there which made me abandon this idea. Still, I want to comment on the content of that file which is a full regular HTML page, plus the JavaScript code. Why is that?

Anyhow, my main problem is that I get such 404s:

mysite.com/folder-if-any/ga.js

I wonder if I could “fix” the script by changing this part:

src='" + gaJsHost + "google-analytics.com/ga.js'

into something like this:

src='http://www.google-analytics.com/ga.js'

...so I ensure the client goes to Google to load the script.

I get an email every time 404 occurs and I like that. But, those GA related 404s are really annoying.

I did ask Google directly, and posted a question under AdWords some tie ago, but no help or explanation has come out.

Any comment is much appreciated.

Thanks

11:31 pm on Nov 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Changing the call to go directly to Google should fix the issue and should be how it was given to you originally in google analytics. I have downloaded the script for some of my sites and call it locally just fine so that avenue would work too. You should use your full URL to avoid issues with a relative call.
2:43 am on Nov 12, 2008 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Thank you very much.

The source I have put here is how it is from GA. I wonder if site search being turned on could cause it. I'll check with them.

In regards of the local call, I was afraid of doing it as I saw extra references back to Google, with relative paths (new GA script).

I’ll see if I can fix it by still having it going to Google.com

Thanks again for clarification.

3:04 am on Nov 12, 2008 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Changing the call to go directly to Google should fix the issue and should be how it was given to you originally in google analytics.

I too would like to see confirmation on this. The original GA code from Google is given to you like this...

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-0101010-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

We have continual challenges in this area with a small percentage of 404s being generated throughout the day on various sites that use the new GA code. I too have previous topics on this that were never really answered.

Personally I believe it is a fail safe to prevent your page from being delayed if there are any performance issues from the GA servers. With the old code, if you had it before your primary content, the page would be delayed while the GA code finished loading. I think the new code provides a fail safe that if the GA server takes too long, it returns a 404 and appends the URI where the 404 took place. I also get emails...

/sub/sub/sub/google-analytics.com/ga.js 

In fact, I just got four of them from one site. Pesky little buggers. ;)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month