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.
Anyhow, my main problem is that I get such 404s:
I wonder if I could “fix” the script by changing this part:
src='" + gaJsHost + "google-analytics.com/ga.js'
into something like this:
...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.
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.
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...
In fact, I just got four of them from one site. Pesky little buggers. ;)