I have 2 domains www.domain1.com and www.domain2.com pointing to the same site.
I want to connect google analytics to them, to track the whole traffic to my site from both domains.
I saw answers to such question here in stackoverflow, that instruct to add the same analytics account ID for all the pages in domain1.com and domain2.com, but in domain1.com use setDomainName(domain1.com) and in domain2 use setDomainName(domain2.com).
That solution confuses me, since I don't understand how google knows that I want to allow summing the statistics from both those domains.
It seems that I can see for example stackoverflow.com's analytics ID and put it in my site, and as a result to add my statistics to stackoverflow's.
What do I miss here?