“How to Keep Translated Pages Related to Original in Google Analytics”

The title of this post is actually the title of a question on stackoverflow, where it was not considered on topic, so I try to answer this here. The person who asked had the following problem (which I think is quite common):

I have a multilingual website.

The URL structure is like:

  • example.com/en/page
  • example.com/es/pagina

So, the first term is the language and then a slug for the page in the right language.

I would like to creat a funnel where both pages count as the same goal.

How can I keep them related?

So the problem here is with the somewhat, ehm, simple way goals with visualizations are created in GA.  You set a goal url, and the urls for the funnel steps (and remember that these apply only to the visualization, not to the goal completion) and hope for the best. So if you have the same pages in several language versions your options are not great. You can either

  • set up multiple language specific goals with funnel (but in a free account you have only 20 goals per view)
  • fiddle around with regular expressions (which would by accident work quite easily for the example in the question, but would become cumbersome as soon as you add e.g. the german “/de/seite” etc.)

My suggestions for this problem would be to create a view where the language specific page urls are substituted by a “language neutral” (actually english) url so they appear aggregated in the reports. That way you do not only have a rollup-view across our language version without incurring additional hits to the server, you can also use a single goal across all versions.  This requires a small change to the tracking code to set a custom dimension, and a bit of configuration in the Analytics interface.

First you create a hit-based custom dimension. Go to the admin section and in the middle column with the property settings select custom definitions/custom dimensions, click new and enter a name:

Bildschirmfoto 2016-04-02 um 20.04.20

It does not actually matter what you enter as a name, since in this case we will not even use it in the reports, just once in a filter. Next, change your tracking code to include the custom dimension (which is addressed in code by using the keyword “dimension” plus the numeric index from the GA interface; the first created custom dimension will be dimension1) :

ga(‘send’, ‘pageview’ , {

The trick here is to assign a value that is the same on all language versions, no matter what is displayed in the address bar of the browser.  So for the example from the question (where the page path is e.g. “example.com/en/page”) you might enter “/all/page”. Make sure to enter only a path, not the hostname !

Next create a new view in Google Analytics – we are going to create a filter that will change the data in an irreversible way, so you want a backup (and of course you still want to work with the original data; quite probably in this situation you already have language specific views). In your new view, go to filters, new filter, custom, advanced and enter the following settings:

Bildschirmfoto 2016-04-02 um 20.44.31

This will extract the value that you have sent as custom dimension and will overwrite the original page path (btw. attribution data  from utm parameters will stay intact in case you are worried).  So the language specific version of the path path will be replaced with a common version for all languages.


Now you can do a roll-up reporting over all your language versions, and in the spirit of the original question this includes funnel visualizations. Construct your funnel from the “language neutral” version of the page path and it will show entries/exists and conversions for the whole site.

Caveat: This will only work if corresponding pages exist in all language versions. You might want to add another custom dimensions and do the same thing for the page title.

One thought on ““How to Keep Translated Pages Related to Original in Google Analytics”

  1. Hi,

    I am the original author of the stackoverflow question.

    This is exactly what I was looking for!

    Thank you very, very much!


Leave a Reply

Your email address will not be published. Required fields are marked *