Reputation: 2621
I'm working on an international website. To support multiple countries and language, a page URL looks like that:
www.example.com/fr-en/Page
where "fr" is the country code and "en" is the page language.
Would it be possible to add a specific google tracking code for each country ?
I would need that in order to give Google Analytics access for each of the countries dealers, where they will be able to view only their country traffic stats. Of course, I will also need a Google Analytics account for all of the site traffic (for all countries).
Upvotes: 0
Views: 3686
Reputation: 7177
You can use a filter on a Google Analytics profile to only include traffic to specific directories. Use a single Property ID on all pages and have one profile with no filters that shows all traffic. Then have a profile per country with a custom filter for the country code in the URL -- for your example, the regular expression would be something like ^/fr
.
Google Analytics allows you to assign access on a profile level, so each dealer would only be able to view their own data.
Note: Filters don't work retroactively -- they only filter new data coming in after they've been applied to a profile.
Upvotes: 2
Reputation: 191
Yes, that is possible.
I thought there are several ways to do that. One way is to add different tracking ID codes to different country's pages.
Here is the codes of google analytics tracking code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxxxx']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
The UA-xxxxxxxxxx is tracking ID you can apply more than one.
The pages under each country or language include copy of code with different tracking ID.
And all pages also include another copy of code that is "global" tracking ID.
Upvotes: 1