I’ve gotten a lot of comments over the weekend about using the new ga.js code with ASP sites. It turns out that the code does not work with nested SP script tags. Also, the new tracking code that GA spits out is not XHTML compliant. These are unrelated issues that are causing a number of issues.
Google knows of these issues and will be pushing a solution soon. I’m not sure when, but soon. In the meantime, here is a copy of the new code that you should use on your site.
Remember, you need to replace “UA-xxxxx-x” with the appropriate information for your profile.
Sorry for the short post… I’m pretty tied up at work but wanted to post this information.
Props to Eivind Savio for sending me a nice email about the problem and a number of solutions.
Hmm, the script block are gone. I meant this:
<script type=”text/javascript” src=”http://www.google-analytics.com/ga.js”></script>
and:
<script type=”text/javascript” src=”https://ssl.google-analytics.com/ga.js”></script>
I just switched over to GA.js this past Friday on my legacy ASP-based site and had the same issue. My solution was the same.. split up the word “script” into two pieces so the idiotic VBScript parser doesn’t fail on something that’s not really a problem.
Thanks Microsloth for trying to protect us from ourselves!
More like: thanks, Google for not testing your product better before you rolled it out. I love Google, but to say I’ve been disappointed with this rollout of the new code would be a big understatement. It doesn’t even work with Blogger! That’s a Google product! Amazing.
Anyway, thanks Justin for posting this info.
Appears crazy that Google would release this new analytics code before ensuring it was valid XHTML.
Andre, can you explain what you meant in your post above about the script blocks? Are you saying these should be included?
Andre,
You’re absolutely correct. You can use those simplified script tags to include the ga.js. The new code that I posted should also work.
Reid,
I agree 100%. It’s kind of amazing that Google would make this change.
Thanks for the comments and thanks for reading.
Justin
@Paul, Justin explains what I meant. You can use those simplified script blocks in stead of the first script block Google suggests.
@Justin: there’s an other problem with your solution: I miss the CDATA blocks, without them the new script is not XHTML Strict compliant.
But, who cares about validation anyway ;)
Hey André,
You’re right, the code I posted is not XHTML compliant. I chatted with Google and they need to decide between XHTML compliant and compatible with MSFT ASP script blocks. They decided to go with the latter.
If you need XHTML compliant script you can add the CDATA blocks.
I believe they’re pushing the code in the next day or so.
Justin
When will the new event tracking feature be released to the public? I wrote all the code to do this and then found out it was in closed beta and it’s not available in my reports :(
Thanks,
Michael
Hi
Good to see a post on this error by Google Analytics, has there been any New Year updates yet?
Thanks
Hi Michael,
I’m not sure when the reporting side of event tracking will be released to the public. It’s a pretty big change for GA and I think they’re going to take it slow.
Andy,
The tracking code has been updated and should be working now. Check your profile settings to retrieve the correct version of ga.js.
Thanks for reading,
Justin
Hi Justin,
It looks like there is an extra space after “ssl” in the code you posted, which could lead to secured pages not beeing tracked:
"https://ssl ." : "http://www.");
Regards,
Paul
Paul,
Thank you very much for the heads up. I made the change this morning. I hope this didn’t cause anyone an issue.
Justin
Hi Justin,
I notice that Google has not yet made public a fix for this problem yet.
This is unacceptable.
Brendan.