: Use Google Analytics to target different sections of a blog I have a blog that targets different regions. The Europe region blog has different sections in different local languages such as English,
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 domain.com/europe. If you click the French section, the URL is like domain.com/europe/language/french. If you click an article in the French section, it is like domain.com/article_name. Notice the article link is not domain.com/language/french/article_name!
More posts by @Si4351233
2 Comments
Sorted by latest first Latest Oldest Best
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'
});
developers.google.com/analytics/devguides/collection/analyticsjs/pages
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.