views:

169

answers:

2

I have google analytics installed for my own domain, http://mydomain.com. Will a user that enters http://www.mydomain.com be counted by the analytics script too?

To me it seems logical that it would, since it is so common to have the naked domain address be the same site as the www-prefixed one, but the analytics documentation doesn't state it explicitly.

+1  A: 

Yes, that has been my experience.

ceejayoz
Thank you, that was exactly the answer I was looking for.
Björn Lindqvist
+2  A: 

Yes, users will be tracked, but the same visitor coming from www.datalookups.com and datalookups.com will be counted as two different visitors. GA uses cookies to store session information on visitors, and since www.datalookups.com and datalookups.com are different hosts, different cookies belong to them. To get over this issue, I suggest to set up a proper HTTP redirection that brings permanently either user from www.datalookups.com to datalookups.com or vice versa—it's a matter of taste. (Not to mention that this method balks search engine crawlers to index your web content twice.)

For the sake of completeness, there is a way to tell Google Analytics to share session information between to different hosts with the pageTracker._setDomainName function, but that is not the right answer for the current situation.

Török Gábor
Nice reply. It's important that you also mentioned the user permanently redirect (ie. HTTP Status 302 - Permanent Redirection) is very important. Search Engines don't like indexing the same site more than once (when url's a different, but point to the same site).
Pure.Krome
@Pure.Krome: to be precise, HTTP *301* is the status code for permanent redirection.
Török Gábor