Search code examples
google-analyticsanalyticsaddon-domain

Analytics for Add-on Domains


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.


Solution

  • 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: