Pregunta

The set-up:

  • 1 site, 2 domains: = mysite.com and mysite.co.uk
  • These 2 domains use DNS to point to the same site (IP).
  • There is 1 snippet of Google Tag Manager (GTM) code just after the opening <body> tag of the site (every page).
  • In the GTM container, I have added both domains on the "Container Settings" page.
  • There is one Google Analytics (GA) account which only contains the .co.uk domain. (An analytics account can only contain 1 domain.)
  • A tag has been set up in GTM with the type of Google Analytics and it has the UA code from the 1 GA account added.
  • A rule has been added to fire on all pages

Now, I don't care whether someone visits via .com or .co.uk, but I want to capture combined analytics for both. My questions is, with the way I've set things up using GTM, will GA save data for both domains ie mysite.com and mysite.co.uk, or do I need to set things up another way to achieve this? Ideally, I don't want to go down the forwarding route i.e. forward all traffic from .com to .co.uk.

¿Fue útil?

Solución

First a bit of pedantry: Google Tag Manager cannot even collect informatiom from a single domain (it's not a tracking tool). And while you can only enter one domain in Google Analytics that domain setting serves no actual purpose; a Google Analytics account can track multiple domains in different "properties" (porperties are sections in an account that each have a unique id) or in a single property via cross domain tracking. Cross Domain tracking is used if you want to treat multiple domains as a single presence on the web (i.e. if you have a website and a shop with different domains, they still belong together).

Now, the way you have set things up data will be collected from both domains. There are at least two caveats:

1) If users can switch between domains inside a session (go from .com to .co.uk and back) their sessions will be interrupted and Google Analytics will register multiple visitors (that's because users are tracked via cookies which are domain specific). To avoid that you'd need to set up cross domain tracking (and how you would do that depends on if you are using Universal Analytics or asynchronous code. Look at your tracking code, if it contains a line that starts "ga("send"...." your are using analytics. If it contains lines that start with _gaq.push you use asynchronous code).

Cross domain tracking documentation for UNiversal Analytics (analytics.js)

Cross domain tracking for asynchronous code (ga.js)

2) By default Google Analytics tracks only the path, not the domain. If pages on both domains have the same path they will be displayed in aggregated form in the reports, that is if you have an index.php on both pages the visits for both will be added up. Maybe that's just fine with you, if they show the same content in any case. Else you'd either have to use "hostname" as a second dimension (which is not a sticky setting, you would need to re-apply that every time you switch to another report), or you create a filter on your view that includes the hostname in the reports.

Those caveats are relevant because data will show up in any case and will look perfectly okay even if it's not (even if you decide that those two things do not bother you you need to take them into account when you interpret the data).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top