Google Analytics Language Codes

885 Views Asked by At

Need help with Google Analytics filters via Custom Reports -- Display LANGUAGE and VISITS where the LANGUAGE values are grouped as EN for each English, etc via 'FlatTable'

My report returns (see first 3 lines):

LANGUAGE | VISITS
---------+-------
en-us    | 55,842
en       | 3,932
en_us    | 248


I would like to see:

LANGUAGE | VISITS
---------------------+----------+-------
 1. en   | 60,022
 2. ...
 3. ...
3

There are 3 best solutions below

3
On

If I'm understanding you correctly, go to Custom Reports and set one up like this: enter image description here

Then, go and to the newly created report and apply a secondary dimension of Language. If you want to 'group' them by language, do a sort by Language.

I add Language to the dimension drilldown so if you were interested in seeing the possible language selection for a particular country you could do that by clicking on the country.

0
On

I'd recommend creating a Custom Dimension to store an extracted part from the Language Setting dimension via an Advanced Filter.

That way you will extend your data instead of replacing parts of it.

  1. Create a Dimension LanguageCode with scope User or Session in the property's settings (Admin > Property > Custom Definitions > Custom Dimensions)

  2. Create an advanced filter Extract Language Code in the view's filter settings (Admin > View > Filter) like so:

    • Field A: Language Settings ([a-z]{1,3}).*
    • Output in: Language (the Custom Dimension) $A1

Be aware that filters get applied during processing, which happens once a day. That means you'll be able to see the result the next day.

Then you'll be able to view reports or build a custom report that uses that new Language Code dimension.

1
On

In Google Analytics Admin create an additional view to the property. Then create two custom filters:

  1. Name (e.g. Language lowercase): Lowercase -> Filter Field: Language Settings;
  2. Name (e.g. Language generalisation): Search and Replace -> Filter Field: Language Settings : Search string: ([a-z]{1,3})[-_]?.* Replace string: \1

That is it. Now all languages in the view will be up to 3 character long and aggregated.

Actually the regex can be more strong, but this one is more wide and covers even some wrong language settings.