Upcoming LunaMetrics Events
San Francisco, Apr 28-30 Los Angeles, May 12-16 New York City, May 19-23 Chicago, Jun 16-18

Domain Canonicalization – Part 2

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.

http://www.lunametrics.com/blog/2008/10/13/domain-canonicalization-part-2/

5 Responses to “Domain Canonicalization – Part 2”

Allan says:

Thanks for this write up. I’ve only recently started to use GA and am just getting familiar with its strengths and weaknesses.

Manuel says:

hi thanks for making it clear, like always :) I would have one more question, i wonder if there is a problem of canonicalization with the campaign tagging or when you use the ._setAllowLinker to pass by the get method the cookie values among differents domains. Thanks.

Amit Kapoor says:

Hi,
Thanks for clearing this aspect also. I knew about canonical error but as SEO point of view . today i got new way of thing for this issue..
Thanks again.
Amit Kapoor

Luke Stevens says:

First, I just wanted to say I love all your fantastic, detailed posts :) Very helpful, thanks!

Secondly, I just thought I’d ask if this was still the case with GA and cookies. I’ve just checked a bunch of sites and they all seem to have .domain.com set as the default cookie domain. It doesn’t matter if I enter the site with or without www in the url (they’re not redirecting – poor form I know), the cookie is still .domain.com , not http://www.domain.com or domain.com. Likewise, it doesn’t seem to matter what is set as the site URL in the profile. I thought it might so I checked, but regardless of whether it was domain.com, http://www.domain.com or http://www.domain.com , the cookies were always .domain.com .

Just thought I’d mention it :)

John says:

Luke,

What you are describing is because the domain of the cookie was explicitly set in GA, with the method: pageTracker._setDomainName(‘.domain.com’);

This tells GA to ignore what is in the address bar of the browser when it reads and writes cookies, and instead to pretend that it is always “.domain.com”.

Hope that help,

John