Google Analytics

How to integrate the Bablic language selection to analytics platforms

Ishai Jaffe avatar
Written by Ishai Jaffe
Updated over a week ago

Bablic provides statistics about language usage in your website, but sometimes we want to dive deeper into the analytics and integrate with our existing analytics framework.

Google Analytics JS SDK

We can add a dimension names bablic-language, which we can query on Google Analytics later on. 

Add Custom Dimension in Google Analytics

  1. Log-in to your Google Analytics account.  

  2. In the PROPERTY column, click Custom Definitions > Custom Dimensions.

  3. Click New Custom Dimension.

  4. Add a Name. "bablic-language".

  5. Select the Scope Session.

  6. Check the Active box.

  7. Click Create.

  8. The Custom Dimension table should look like this. Not that the dimension index is 1. If you have more dimensions, the index might be different, remember that index for later.

Send Analytics the user language code from Bablic

Your GA integration code might look like this:

ga('create', 'UA-SOME-ID', 'auto');
ga('send', 'pageview');


Edit it to create a new dimension:

ga('create', 'UA-SOME-ID', 'auto');
if(window.bablic && bablic.getLocale) {    
    ga('set', 'dimension1', bablic.getLocale());
}
ga('send', 'pageview');

  • If you custom dimensions before add Bablic dimension, the value "dimension1" should be replaced with the index in the custom-dimensions table in your Google Analytics account. (For example: "dimension4")

Generate Custom Analytics Report 

Follow this guide to generate a custom report with your new custom dimension "bablic-language"

Did this answer your question?