Domain Canonicalization - Part 2

October 13, 2008
By John Henson

In the last post, Jim talked about why your domain names should be consistent.

But what does any of that have to do with Google Analytics?

I’m going to attempt an analogy.  I don’t have a lot of historical success with analogies, but I tried this one on some other people and they didn’t tell me that I’m an idiot, so I’m going to give it a shot.

Google Analytics is like a person with a severe case of short term memory loss.

Every time a visitor views a page on your website, GA records all of the details–when they arrived, what the page was, etc.  It does this by writing this information to cookies on the visitor’s computer.  But when the visitor views the next page, Google Analytics no longer knows who they are.

Good thing thing GA wrote it all down !!

GA looks at the cookies for that visitor to remember who they are.

But when i say a *severe* case of short term memory loss, I really mean it. GA doesn’t even know what cookies to look at.

Thankfully, cookies are tagged with the domain of the website.  So GA checks the address bar in the browser to find the domain.  Then it can find the right cookies.

Now we can start to see why www.domain.com and domain.com need to be consolidated from an analytics perspective.

If a visitor comes to www.domain.com, GA writes down it’s information to cookies that are tagged with “www.domain.com” because that was what was in the address bar.

If later they visit a page that is just domain.com, GA will read and record cookies tagged with “domain.com” to identify that visitor.

Imagine our person with short-term memory loss.  He writes everything down in a notebook.  But what if he uses one notebook in the dining room, and a different notebook in the living room?  When he’s in the dining room, he only knows about things that happened in the dining room.  When he’s in the living room, he only knows about things that happened in the living room.

This is what goes on with GA.  When the visitor is on the website “www.domain.com” GA only knows about things that happened on “www.domain.com”.  When the visitor is on “domain.com” GA only knows about things that happened on “domain.com”.

GA is now maintaining two distinct sets of cookies (notebooks) for this visitor.  Your data will show 2 visits instead of one.  One visit will have all of the pageviews to www.domain.com, and the other visit will have all of the pageviews to domain.com.

If you haven’t already, check out the previous post for some ideas on how to get started with consolidating your domain names.