Sun, 10 Feb 2008

Multi-Domain Tracking with Google Analytics/Urchin Tracking

If you are trying to track multiple domains within the same Google Analytics or Urchin profile, make sure you are using the same tracking library on all sites. I was attempting to track a visitor from one site using urchin.js to another using ga.js, and I spent a few hours trying to figure out why it wasn't working.

It turns out that the cookie data is encoded differently in query string appended to the url of the site to which you are passing it. With urchin.js and __utmLinker(), the __utmz cookie is url-encoded, but not with ga.js and ._link(). Compare the two URLs below.|utmccn=bogus|utmcmd=clicky%2Bclicky&__utmv=-&__utmk=54196648

The ga.js _initData() won't properly parse the __utmz data from the query string in the first example. I hope this saves someone else some time.

tech | Comments | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat