If you run multiple websites but have the same tracking code for Google Analytics on all of the sites, how do you set up your tracking so you have accurate information on a site-by-site basis whilst maintaining your historical data?
This is something we come across a lot when working on client websites and something I know a lot of people have issues with.
Why would I need to do this?
There are a number of instances where this is something you might want to do; for example, if you have different country sites which appear on a sub-domain or sub-folder. In this instance, each unique country is likely to need to report on its performance, but as a company you also need to track all the sites together as a combined report to show the overall company performance.
Another reason this comes up is because the analytics for a site may have been configured incorrectly years ago and as a result you need to be able to split out your traffic without losing all of the data you have collected over a period of time.
How to track multiple domains in one Analytics account
The first thing is that you need to make sure you have configured Cross Domain Tracking correctly, which I covered in a post on this blog in February this year – you can read this here.
Once you have done this and your master Analytics account is receiving ALL the traffic for all the domains in one report, you could find you have an issue with how pages are showing up. For example, if you have three sites being tracked by the Analytics account, this will mean that the traffic to the homepage in Analytics will combine all three homepages. This is because the homepage will record all traffic that reaches the Unique Resource Indicator (URI) for the homepage. This can throw off all of your reporting on things like bounce rate, entrance rate and even the in-page analytics for the homepage.
To resolve this using the same tracking data you can set up filtered profiles. To do this you need to be an administrator on the Analytics account.
In the below example we are going to set up tracking for two websites: www.yourdomain.co.uk and www.yourseconddomian.co.uk.
What’s the difference between an account and a profile?
Before we move on I thought I’d write a quick explanation of the difference between an account and a profile in Google Analytics.
Account: Totally different section in Analytics; new tracking code; new set of data. The UA number will change for this, so your first account will be UA- 1234567-1 and your second will be UA- 1234567-2
Profile: Same tracking code; different view of the data. So the UA number remains UA- 1234567-1 but filters, user permissions and additional goals can be configured. One unfiltered profile (the primary and first analytics profile set up) must be kept because once you apply a filter to the main account your information can’t then be unfiltered – and any traffic filtered out of the master profile will be lost and can’t be retrieved later.
Setting up a new profile
To begin this process we need to set up a profile for each of the two domain names.
Go to the Admin section of Analytics and select the name of the account you want to add new profiles to. When you are in the right place in Analytics the menu will look like the image below and reference “Profiles” and not “Accounts”:
From this screen click the New Profile button shown above and the below form will be created:
Add a profile name – which can either be the URL or a sensible name for the profile – for example, ‘Company Main’ site or ‘Company Shopping Site’. If you are running international sites it might be worth calling these something like ‘Company France Traffic’. Make sure your naming convention makes sense and you are sure everyone in your organisation will understand the names used.
Click the Create Profile button and you are now ready to add filters.
Setting up the URL filter
Go through to your new account and in the Admin section click on the Filters tab as shown below:
Click the New Filter button and the below form will appear:
Firstly give your filter a name and make sure the Predefined Filter box is selected.
For these filters you need to include only the traffic from a specific place, so change the drop down which reads ‘Exclude’ by default to ‘Include only’
The new filter box allows you to set up a filter on a sub-folder or a domain.
For the domain, select the ‘traffic to the hostname’ option from the drop down box and enter the URL of the domain you want to track. Do not include the www. at the beginning, as shown below:
For traffic to a sub folder (e.g. your France sub folder for French traffic), choose Traffic to the Sub Directories from the drop down box and enter just the name of the sub directory (in this case our folder is called /fr/ as shown below:
Once you have set up the rules click the Save button.
Your new profile will now only track traffic to the required domain and not the other domain names.
If you have already set up filters to exclude traffic from your company then these filters also need to be added to the new profile.
Remember, it’s important to maintain the original account unfiltered because if you remove some of the traffic from this master Analytics view you can’t retrieve it for use somewhere else.
Repeat these steps until you have creating one profile for each site with its own unique filter. This will leave you with one master Analytics profile for ALL your traffic and one for each sub-site, which will enable you to track each site separately.