1

I have a blog that targets different regions. The Europe region blog has different sections in different local languages such as English, French and German. I wonder how to track and analyze the different sections.

My initial thought is to search the domain URL, but I found it is not a good idea. For example, the URL for the Europe blog is like www.domain.com/europe. If you click the French section, the URL is like www.domain.com/europe/language/french. If you click an article in the French section, it is like www.domain.com/article_name. Notice the article link is not www.domain.com/language/french/article_name!

dasickle
  • 3,658
  • 16
  • 40
Emily Yao
  • 11
  • 1

2 Answers2

2

Short of rethinking you URL structure (I'm with Stephen Ostermiller), you can use Virtual Pageviews and some conditional switching for this. On your template that displays single posts, you'll need to do some checking. Pseudo code...

$region = get_the_region();
$lang = get_the_language();

Then, instead of the default call to GA:

ga('send', 'pageview');

you'll print out those variables in a virtual pageview.

ga('send', 'pageview', {
  'page': '<?php echo $region . "/" . $lang; ?>/article-name'
});

https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

Will
  • 401
  • 3
  • 6
0

You may want to rethink your URL structure. There are good SEO reasons to put all your French content into a single directory that is separate from the other languages. See How should I structure my URLs for both SEO and localization?

If you can't do that, Analytics does allow you to specify a custom variable. The variable could specify the region and language for the page. Your blog would need to set the custom variable in the Analytics JavaScript snippet for each page view.

Once the custom variable is in place, you can get segmented reporting using advanced segments within Google Analytics.

Stephen Ostermiller
  • 98,758
  • 18
  • 137
  • 361