December 2007
Posted on the 14th at 11:14 AM CST
Google Analytics Causes Script Errors
FiledFiled under Javascript, Stuff

I absolutely despise Javascript errors. When I enable script debugging in Internet Explorer, I usually have to turn it off immediately because of how quickly I get annoyed. It's pretty hard to justify the ridiculous amount of script errors scattered across the web, even on some of the most prestige web sites. It is actually quite funny, and I think they should be embarassed. Anyways, I accidentally left script debugging on in Internet Explorer last night and today I came to my blog and was greeted by a nasty script error...

Object Expected Script Error


Ahh, an object was expected. Of course. This was rather appalling because I generally go to great lengths to make sure my code is free of any potential errors. On top of that, I have not made any recent changes. As it turns out, Google Analytics provoked this one, which was also surprising...

Urchin tracker not found 


I love Google Analytics, but I hate script errors. Why in the world can't it locate the urchinTracker function? I went a step deeper and as it turns out, the Google Analytics script URL gives me a 404 error. What's up with that?! C'mon Google, get your DNS straightened out or do something. Since I hate script errors so much, I decided to modify the code to prevent the error from happening again. It is pretty simple, really. All you have to do is check to see if the urchinTracker function exists before invoking it. I simply changed my Google Analytics script to this...

if(urchinTracker)
    urchinTracker();


No more script errors, but Analytics still is not working. A compromise, I guess.

Comments (4)
Permalink Comment from SeanEmail on December 14th, 2007 at 11:59 AM
That is surprising! Google usually does extremely well with their javascript.

I would not consider that a compromise, though. If it doesn't work, it appears that Google has won.

I wonder what happened to the Urchin...
Permalink Comment from Josh StodolaEmail on December 14th, 2007 at 12:56 PM
Very surprising indeed. I don't know what the deal is, it still is not working!
Permalink Comment from me =) on August 11th, 2008 at 12:53 PM
has google changed the script yet? i just discovered this absolute fab website today! so anyway its now being a while before the you discovered the error. i am wondering if google has corrected this?
Permalink Comment from Josh StodolaEmail on August 11th, 2008 at 4:49 PM
I believe it was a matter of timing. Yes they've corrected it, and from what I remember the problem only existed for a couple of hours. Google doesn't mess around ;)

Thanks for the comment!

Guess What?

There are a few basic guidelines you should be aware of before leaving a comment…

  • If you choose to display your email address, it will not be detected by spam bots
  • Comments are limited to 3,000 characters; so far you have used none of them
  • HTML will be encoded; links and line breaks will be converted automatically
  • Comments containing five or more links will be subject to moderation

Have Your Say

← Answer this to prove you are human
 
 

Chill Out…

No Trackbacks