Optimize
4.8K members online now
4.8K members online now
Learn how to create your first experiment and get tips on creating A/B, redirect, and multivariate tests.
Guide Me
star_border
Reply

Google optimize AB language

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I want to make an AB test to try different text.

The problem is that, we have users who use our site in different languages, is there any possible than I can try at the same time with different text in depending of the language of the browser or something like this? 

 

Thanks in advance.

1 Expert replyverified_user

Google optimize AB language

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

Hi,

 

Did you find the answer anywhere?

Google optimize AB language

Google Employee
# 3
Google Employee

There is not a very simple way to do this, but there is a one if you are a little bit familiar with javascript.

 

First of all you need to find out a way to detect what language a user is seeing.

If the URL is the same for both languages, you may try to check the language attribute of the page:

 

Open up chrome developer tools at type:

document.documentElement.lang

 

If this gives a different value for your 2 different languages then do the following:

 

- Click on the element where you want to change the text

- Instead of "Change text" use the "Run javascript" edit option

- In the javascript write a little bit of code that does what you want, for example something like:

 

if (document.documentElement.lang == "en-US") {

  element.innerText = 'hello';

} else if (document.documentElement.lang == "fr") {

  element.innerText = 'bonjour';

}

 

If the document language property is not set (for some reason), you may even use something else - like the document.title.