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. Click Admin, and navigate to the property to which you want to add custom dimensions
  3. In the PROPERTY column, click Custom Definitions > Custom Dimensions.
  4. Click New Custom Dimension.
  5. Add a Name. "bablic-language".
  6. Select the Scope Session.
  7. Check the Active box.
  8. Click Create.
  9. 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?