• Home
  • Google Analytics
    • Customizations
    • For Ecommerce
  • Speaking
  • About
    • About Me
    • Contact Me
    • Disclaimer and Privacy Policy

Analytics Talk

Digital Analytics for Business

You are here: Home / Tracking / Updated GA.JS Tracking Code

Updated GA.JS Tracking Code

Posted: December 17, 2007 17 Comments

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.

Filed Under: Tracking Tagged With: asp.net, ga.js, setup

Comments

  1. André Scholten says

    December 17, 2007 at 3:54 pm

    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>

    Reply
  2. Ian says

    December 17, 2007 at 4:10 pm

    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!

    Reply
  3. Reid says

    December 17, 2007 at 9:59 pm

    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.

    Reply
  4. Paul Galatis says

    December 18, 2007 at 6:10 am

    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?

    Reply
  5. Justin Cutroni says

    December 18, 2007 at 4:49 pm

    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

    Reply
  6. André Scholten says

    December 18, 2007 at 5:57 pm

    @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 ;)

    Reply
  7. Justin Cutroni says

    December 18, 2007 at 9:06 pm

    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

    Reply
  8. Michael says

    December 27, 2007 at 4:13 am

    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

    Reply
  9. Andy S says

    January 4, 2008 at 4:31 am

    Hi

    Good to see a post on this error by Google Analytics, has there been any New Year updates yet?

    Thanks

    Reply
  10. Justin Cutroni says

    January 11, 2008 at 11:55 am

    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

    Reply
  11. Paul Bernier says

    January 18, 2008 at 12:13 pm

    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

    Reply
  12. Justin Cutroni says

    January 20, 2008 at 8:45 am

    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

    Reply
  13. Brendan Halloran says

    February 15, 2009 at 10:58 pm

    Hi Justin,

    I notice that Google has not yet made public a fix for this problem yet.

    This is unacceptable.

    Brendan.

    Reply

Trackbacks

  1. WebmasterFarms - The Science of Knowing Your Customers » Blog Archive » Updated Google Analytics Tracking Code for ASP sites says:
    December 21, 2007 at 1:05 am

    […] … Feel free to check on Justin’s site and read his brief article on this subject.  Happy Googling! […]

    Reply
  2. Updated GA.JS Tracking Code says:
    January 4, 2008 at 4:41 pm

    […] Go to Analytics Talk to get the new code! […]

    Reply
  3. Analytics Talk » Blog Archive » 2008 Google Analytics Resolutions says:
    January 8, 2008 at 10:17 am

    […] Google announced a new version of the tracking code, ga.js, in October 2007 and launched the new code in December. After some minor launch problems things seem to be running smoothly. While you don’t need to migrate to ga.js, you should start to think about it because Google will no longer add features to urchin.js. In my opinion, you should tackle this problem sooner rather than later. […]

    Reply
  4. Updated Google Analytics Tracking Code for ASP sites | Pure Web Analytics says:
    March 18, 2008 at 8:12 pm

    […] Feel free to check on Justin’s site and read his brief article on this subject. Happy Googling! […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

My Books

Google Analytics by Justin Cutroni
Learn More on Amazon.com

Performance Marketing co-authored by Justin Cutroni
Learn More on Amazon.com

Recent Posts

  • Understanding the Google Analytics Cohort Report
  • Using Offline and Online data to drive Google Analytics Remarketing
  • Understanding Cross Device Measurement and the User-ID
  • Universal Analytics: Now out of beta!
  • Advanced Content Tracking with Universal Analytics

Categories

  • About Google Analytics (25)
  • Analysis (52)
  • Analytics Strategy (3)
  • Campaign Tracking (14)
  • Ecommerce (8)
  • Event Tracking (10)
  • Remarketing (2)
  • Reporting (10)
  • Resources (7)
  • Tag Management (5)
  • Tips (25)
  • Tracking (52)
  • Uncategorized (64)
  • Universal Analytics (9)
  • Web Analytics (15)

Copyright © 2023 ·News Pro Theme · Genesis Framework by StudioPress · WordPress