Thursday, April 3, 2008

«Cross-Domain Tracking»

When clicking on a link to another section of the website, you may notice a long and seemingly random string of letters and numbers in the address bar. That's just part of the multiple domain tracking I've implemented. If you copy the link, you only have to copy the stuff before the # symbol.

The two domains I'm using are and The homepage of the googlepages domain will re-direct here to the blog unless you disable javascript. I was tracking the two domains separately, but that was starting to give me inaccurate data. It would register as leaving the site when going between domains. This messed up stats on bounce rate, page visit depth, referring sites (they would refer to each other), even number of visits among other things.

I looked into how to fix it and found a page in the Google Analytics help files that gave instructions for doing exactly what I wanted (never mind the little typo in the instructions; ">" before "onclick" in step 2). So I followed the instructions. The result was a 400 Bad Request error when you clicked on one of the links between the domains. Nice.

I posted a question about it in the Analytics Help Google Groups and got the answer I was looking for. It was blogger's problem, I just had to instruct the tracking code to use # instead of ?.

Here's what was said:

As for the 400 error, that's a problem with blogger, it's seeing the
__utma, __utmb, stuff in the URL and saying "those aren't valid
blogger variables" and then dies.

Try setting useHash to true, so the __utm* is in the hash (#) and not
the query string (?)
onclick="pageTracker._link(this.href, true);"

- ShoreTel

So all I needed was to add ", true" and it worked. Why am I saying this in my blog? Because I couldn't find the information clearly anywhere. Maybe someone with the same problem will now run across this blog post and not have to go through what I did trying to figure out what went wrong.

1 comment:

  1. Just a quick note:
    This is an older article, and now I'm hosted at my own domain and everything is now in subdomains of the one master domain. So I'm using a different tracking method. No more random strings of letters and numbers in the address bar.


Thanks for taking the time to comment.

Note: Only a member of this blog may post a comment.

»» «« »Home«