Google Analytics - site with 2 domains, how to track each domain individually? - google-analytics

I have a website with 2 domains. I am trying to track the domains separately. I have both domains inside the same GA account - each domain has a filter applied to it to exclude the other's domain (both with and without the www). It looks like the domains are still being tracked together. How would I go about separating these 2 for different results?
Thanks!

What you're doing now is sending all the traffic to one account (say, UA-XXXX-1), and then using filters to separate them out. This is an imperfect solution, since filters have odd session-related quirks that make them less than ideal for tracking completely separate domains.
To completely separate the results, you need to create separate new web properties within your Google Analytics accounts , so that instead of tracking the second domain on UA-XXXX-1 and filtering, to send the data to UA-XXXX-2. It will roll up in the same area of your analytics account, but it will totally separate and segment the data.
You can read more about the organizational concepts here at this excellent Google Analytics Help Center walkthrough.
To set this up, you'll setup a new profile within the account and select "Add a profile for a new domain" as your option. There's a detailed walk through here.

Related

Google Analytics: Which domains are sending data

Is there a way to tell which sites my Google Analytics tracking code is implemented on? I am suspecting it may have been used with different micro landing pages with different domains and sub-domains. (Our developers were testing a cross domain tracking but did not went as expected)
I could not figure out where to see this on my GA reports, tried to search it but all ends up explaining referrals list which I am not looking for:(
You can check what Hostnames are sending data to the GA reports for a Property, via the Audience > Technology > Network report. Change the Primary Dimension from Service Provider to Hostname.
Filters are not retroactive, so you can instead create and apply a Segment based on Conditions to Filter Sessions Include based on Hostname that exactly matches yourdomain.com.
Doing this will allow you too also view the historical data in your reports in relation to valid Hostname
More info on building segments from the GA Help Center
https://support.google.com/analytics/answer/3124493?hl=en

Setting up google analytics for different domains

I have a web site that several parts are hosted in a different name server. but they are practically the sub parts of the same sites. (i know it's badly designed)
Currently, i get analytics data for each domain. but what i don't like about that is when you are jumping to the other domain, it marks as a drop off. Is there anyway that i could setup analytics in such a way that it treats both domains as a single website?
You are looking for cross domain tracking. Google has quite extensive documentation on this. Follow the instructions for Cross Domain Autolinking, manual linking is usually unnecessary and somewhat error prone.
The basic idea is that, since the cookie that stores the client id is domain specific, the id that identifies users must be carried over in some way from one domain to another. This is done by putting it in the url, in a parameter named "ga". If the other domain is configured for cross domain tracking it will take the parameter from the url instead of generating it's own client id. When GA processes the data on the serverside it will recognize that the calls from the different domains (but the same client id) belong to the same session.
Google Analytics (via the autolinking plugin) provides functions that automatically "decorate" links and form, i.e. they add the ga parameter to the links that point to the linked domain, or to form actions. This works well with plain links and forms, but might not always work with javascript callbacks on the links that redirect instead of just following the link.

Google analytics for any domain

Is there any way to track analytics for for all domains except a specific one?
If I develop a tool that will be integrated in some websites, I don't know what is the domain to track, but I would track the access from any domain.
How can I do that?
The Google Analytics tracking code will work for all domains if you set the Cookie Domain to auto (or "none", but that has side effects that "auto" has not). You can then filter or segment by hostname to get data for individual domains.
However this is not the same as "cross-domain" (since you tagged your question with that). Cross domain tracking means "tracking multiple domains as one property", so GA sessions will be maintained even when crossing domain boundaries. This is not relevant at all to your use case.
Maybe it would be better if you implemented tracking via the measurement protocol. If you simply add GA tracking code to existing websites you might break tracking that is already there, if you build your own solution on top of the measurement protocol you don't have to worry about that but you can still use the standard GA reporting interface.

Can I use Google Tag Manager to collect analytics from mulitple domains?

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.
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).

Multi-domain setup on Google Analytics

We have a dozen or so sites, as well as the occasional subdomains so:
example.com
example.co.uk
us.example.com
etc
We have been using separate GA codes for each site. This works fine, but it means that adding a new site means getting a new code and we can't tell overall stats (e.g. how many people have visited all sites etc). If we went the one code route and set up separate profiles for each domain/subdomain:
1) Should we use _setDomainName("none") or _setDomainName("www.example.com") and _setDomainName("www.example.co.uk") etc
2) Will each domain profile treat the other domains as separate (e.g. will we tell on example.co.uk how many people visited from example.com and completed goals etc)
3) Are there any disadvantages to this method.
This post from the Google Analytics blog details how to set up a GA account for each site, and an overall 'rollup' account which sits on top - this will let you give separate GA admin control for each site, where you can dig deep into each site's account, and show cross-site referrals, and the rollup will give overall numbers (but I don't think it's going to report on unique visitors across the collection of sites).
http://analytics.blogspot.com/2009/09/advanced-structure-your-account-with.html

Resources