Great news for Google Analytics fans, December 13, 2007 marks the official arrival of the replacement to urchin.js we have all come to know and love (or hate) 🙂
The urchin.js tracking script has been downgraded to legacy status and should be phased out within the next 18 months or so.
The new ga.js code has a new syntax and comes with all sorts of bells and whistles to make your life easier and, let’s face it, spend more time hooked on GA 😉
Included with this update is the beta functionality that allows for the analysis of multiple metrics directly from the calendar interface. You may now select page views and visits for instance and compare them across time periods or against the entire site.
New tracking code and functionalities
If you look at your Google Analytics interface under Settings > Check Status, you will see that Google now offers both code snippets for the GATC (Google Analytics Tracking Code) that rely on the _getTracker method which generates a page tracking object with a host of new functions.
Here is what the code will look like:
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
var pageTracker = _gat._getTracker("UA-XXXXX-XX"); //Don't forget to replace your profile ID!
Note that :
- urchinTracker is replaced by the _trackPageview function to measure page views as well as custom links (downloads, Flash, Ajax) but still count as an extra page view
- The _trackEvent method, however, should track custom events without registering an extra page view so it will be ideal for web 2.0 . Note that the event function is still in beta phase and does not include proper reporting as of yet.
- HTTP/HTTPS selection is now automated based on the page’s current protocol.
- Other functions include replacement variables for campaign values as well as e-commerce tracking
- The complete API guide is at http://code.google.com/apis/analytics/docs/
- Function reference: http://code.google.com/apis/analytics/docs/gaJSApi.html
Keep in mind this is still in beta stage but works good enough for me 😉
Proceed with caution and feel free to ask questions 😉