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 and need to be consolidated from an analytics perspective.

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

If later they visit a page that is just, GA will read and record cookies tagged with “” 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 “” GA only knows about things that happened on “”.  When the visitor is on “” GA only knows about things that happened on “”.

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, and the other visit will have all of the pageviews to

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

John is a former LunaMetrician and contributor to our blog.

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

  • Manuel

    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.

  • 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

  • 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 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 , not or 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, or , the cookies were always .

    Just thought I’d mention it 🙂

  • John


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

    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 “”.

    Hope that help,


Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187