0

I have a website that can be accessed from two different URLs. The same files and the same database are used, with the exception that the server-side language reads the domain name and if it's one or the other it serves a different language by changing the language variable.

Now, how should Google Analytics be implemented in this case? Should I have a different code for each domain, or one for both?

Thank you.

Facundo Casco
  • 10,065
  • 8
  • 42
  • 63
Francisc
  • 77,430
  • 63
  • 180
  • 276

1 Answers1

2

Will your two websites always be looking at the same database, etc? Or is there any chance that the content of the two sites will differ from each other in the future?

If your current setup is going to persist, I suggest using the same tracking code on both domains. There is some additional configuration to do first.

Create the following filters (as per reference links below):

  1. Show full page URL
  2. Show only traffic from DomainA
  3. Show only traffic from DomainB

Then create the following 4 profiles:

  1. Using the same Google Analytics tracking code on both websites will make the data flow into a combined report. This is your master profile.
  2. Make a copy of your profile. Apply the 'full page URL' filter to the profile. This profile shows both domains with full URLs.
  3. Make a copy of your profile. Apply the 'full page URL' filter and 'show traffic from DomainA' filter. This profile shows just DomainA with full URLs.
  4. Make a copy of your profile. Apply the 'full page URL' filter and 'show traffic from DomainB' filter. This profile then shows just DomainB with full URLs.

This setup will allow you to slice the same data in a number of different ways, depending on what you need to report on. We have implemented a similar solution before and find it quite powerful.


Filter reference:

Ciaran
  • 1,904
  • 16
  • 27
  • Hi, Ciaran. The current setup will never change, they are supposed to be the same site in different languages. If I understood right, you are saying to use the same GA tracking code and only register one account in the GA interface and just use filters if I want to see separated analytics, correct? – Francisc Apr 04 '11 at 11:43
  • 1
    Correct. One account in GA which creates the master profile. Then three copies with filters applied to see the separate stats. – Ciaran Apr 04 '11 at 12:15
  • 1
    No worries. And once you have it set up, you can use custom variables on your master profile to track the language settings. But I leave that as an exercise for the reader ;) http://analytics.blogspot.com/2010/06/power-of-multiple-custom-variables.html – Ciaran Apr 04 '11 at 14:03
  • Ha ha, I'll read it. One more thing, just to make sure, it's the `Multiple top-level domains` that I am interested in rather than `A single domain` for mysite.localTLD and mysite.com, right? – Francisc Apr 04 '11 at 15:03
  • 1
    Yes, use the snippet from `Multiple top-level domains`. – Ciaran Apr 04 '11 at 16:48