"Error: urchinTracker not defined" fix for Google Analytics urchin.js

I've been very impressed by Google Analytics, but I noticed an error appearing in FireFox browsers. While apparently harmless, it makes it hard to debug your JavaScript if something else is shouting for attention :)

So, I replaced the reference to Google's urchin.js with a fixed version (thanks to Caleb who provided the modified routine). You are welcome to copy this to your own site and use it there.

Hope this little patch helps some other folks being bothered by the same issue. If anyone finds an error in the modified urchin.js, please let me know.

View source (it's at the bottom of this page, just before the closing body tag) to see it live, or just copy the file urchinjs.txt to your server as urchin.js, and replace the reference to Google's copy to your own version.

Please don't hotlink this script. It's given freely. I'd really, really like it if Google Analytics would pick it up, use the modification, and then let me know so I can update this page saying so.
Anyway ... It wouldn't be very smart to blindly link to a script on another domain, now, would it? Unless you trusted them a lot ...

Thanks to PaperFish, for inspiring me to bother making this fix.

Comments

Thanks Giant Robot ! You're

Thanks Giant Robot ! You're a good friend ;-)

[...] Para solucionar

[...] Para solucionar -realmente- este pequeño error, pueden usar una versión modificada del script de Google Analytics o cambiar lo siguiente para evitar que se muestre el error [...]

Hello, I am getting this

Hello,

I am getting this message as well and I don't even know what to edo with your script. I have no clue what and where I have to replace some code.

I would appreciate to receive your advice.

Thanks in advance and kind regards

Klaus Lang

@Klaus: did you install

@Klaus: did you install Google Analytics on your site? Is it your site that gives you that error?

@Jeroen: thanks, and good point. Did your AdBlock filter also pick out urchin.js from this site, or just from Google? So the slightly longer code snippet posted at buayacorp's post is a more complete fix.

Have been pondering a way to add Google Analytics to MySpace by referring to the stats grabber as a CSS background. Obviously you'd loose lots of the dynamic stats (screen res etc), but you'd still get lots of interesting info.

I do speak Javascript but I

I do speak Javascript but I don't speak Spanish, so I can't read the article here - just the code :)

http://www.buayacorp.com/archivos/google-analytics-urchintracker-is-not-...

This site has an alternative workaround ... Haven't tested it but it looks like it would work fine.

The approach suggested there might not give you GA for Firefox users - can anyone confirm this?

Basically what might

Basically what might happening is that AdBlock is blocking urchin.js (some people might be blocking it). But that was still not the case for the person in question, hence his change to get rid of the error.

The solution

The solution is in the google analytics guide

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <code> <br> <h2> <h3> <h4> <h5> <h6>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.