International subdirectory implementation in Google Analytics
First of all, you will need a single property in Google Analytics for your website, with one tracking code used across all subdirectories. You will then use the Views feature to separate each subdirectory’s data.
You will need to set up a Google Analytics account (if you don’t already have one), and place the tracking code across all the pages on your website, which can be found in your Google Analytics account here:
Next, put together a list of the URLs for all your country subdirectories. As an example, I will use a Portugal subdirectory on a .com domain – www.example.com/pt. This method would also work for language subdirectories.
If you have built your international website using country subdirectories, your structure probably looks something like this:
You will then need to create a new view in Google Analytics for each country, and add a filter to it so only traffic relevant to those country-specific pages can be seen within that view.
Important Note: Creating these filtered views will track the traffic to the subdirectory pages, but the view doesn’t signify the country which the traffic is from in terms of geographic location. If you created a French version of your site on a subdirectory targeted to users in France, and set it up correctly in line with Google’s guidelines, you would expect a large proportion of users to be located in France. However, you will still need to view the Geo reports within the Audience tab.
Also Remember: You should retain one main unfiltered view of everything that is happening on your website and it is always best practice to create a new view when you filter out any data.
Step 1.Add a new view for a country or language subdirectory
- Go to the Admin tab
- Click on the drop-down menu in the view tab and select “create new view”
- Then select Website
- Enter a name for your view
- Select the country and time zone
- Click “Create View”
Step 2 – Add a filter
Next, you need to filter the data so that only traffic to the Portugal subdirectory pages is reported in this view.
Simply follow the instructions below:
- Select the view you have just created
- Go to the Admin tab
- Click on Filters
- Click “New Filter”
- Amend the fields as below
Step 3. Testing
Next, you need to test whether this is working correctly and check that the right data is being pulled through into the view. You can check this by going into the real-time section of the Reporting tab, and then open a page from the main domain or from another country subdirectory on your website. Within the real-time report in Google Analytics, the page you are currently viewing should not be reported as currently active as it is not contained within the filtered subdirectory:
Whether or not you decide to segment your language or country content in this way is dependent upon how useful it will be to your business and if you need to quickly and easily analyse traffic to a particular subdirectory on your website. This method also allows you to create Goals for a specific view (e.g. a submitted contact form). Another potential benefit is that if you have separate country-specific Google AdWords accounts, you can link them up to the corresponding views in Google Analytics.
Have you just learned something new?
Then join the 80,000 people who read our expert articles every month.