Google Analytics: What is this /NaN thing?
May 31st, 2007 by Ernesto GluecksmannRecently we started setting up our clients with Google Analytics. After Google’s recent upgrades to a more Ajax styled reporting GUI, we found it to be quiet the upgrade. There’s tremendous improvements in layout and flexibility, along with simplified explanations. Very easy for our customers to get in there and get around.
For one of our clients, we started to see the characters “/NaN” as one fo the pages of significant traffic, located in the Content reports. There’s no page called /NaN, it is actually a JavaScript error that means “Not a Number”.
Well, it turns out that this is usually an indication that there’s some other JavaScript on the web page that interfering with the JavaScript that is download from Google. The way to fix this, is to move Google’s code up into the <head> tag of your web page.
We usually add the Google Urchin code at the bottom as indicated by Google, but in this case, the second recommendation it above all other JavaScripts.
Once we did that, Google Urchin code was run first and that fixed our odd /NaN problem.


August 31st, 2007 at 11:24 pm
Thanks for posting this.
We had supposed Google Analystics Experts look at a couple of our client’s site and they never even commented on the funnel showing Nan URLs let alone know the answer!
You have save us a lot of time!
November 19th, 2007 at 3:56 pm
Thanks for this post. I ran into this issue for the first time today and your post is the only answer I could find.
March 10th, 2008 at 7:32 am
I tried your solutions and it didn’t work. My google results when flat and the page was not even working. Do you have any other thoughts regarding the NaN problem?
March 10th, 2008 at 10:56 am
Hmm, that sounds more like a problem with the page itself. Moving your GA code into different positions, should not affect the page. If you’re saying the page itself is now broken, then you may have overwritten some of page’s important tags. And, GA may skip over broken pages if it can’t tell it’s an HTML document. I’ll email you directly.
September 14th, 2009 at 5:46 pm
The GA code must be the last thing to load on a page so moving it to the header is not a good idea.
Trying to troubleshoot the JavaScript error is a better way to go.
October 14th, 2009 at 1:51 pm
Hi Paul, you are correct, it is recommended that your GA code be placed at the end of a page. However, it’s not necessarily required. The reason for placing it at or close to the bottom, is if there’s problem with Google itself, it won’t affect the rest of the page from loading. But again, that’s largely mitigated now with modern browsers.
We deal with a lot of small business clients that don’t really have the budget or expertise to dig through JavaScript warnings to resolve something like this. So… sometimes, good enough.. just is.
April 11th, 2010 at 9:28 pm
I have run into the /NaN issue a few times with clients. It is amazing how overlooked this issue is and and how little support Google offers on it directly.
Regarding placement of code: Placing the script at the bottom of the page does allows Google to run last and indeed not conflict with other potential elements on the page. This was largely an issue occurring for IE6: Hopefully soon IE6 will be gone and we can all enjoy the web once again. I know every developer out there has lost many hours, days, (or hair) debugging issues with IE6. The new Google Asynchronous tracking code will lighten the load too and actually is place in the element of the page.