AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

2.5K members online now
2.5K members online now
Discover how to select who is eligible to be in your experiment, and when they’re served experiment variations.
Guide Me

Target Optimize experiment to only a certain language

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

There does not seem to be a way to target en experiment to a specific browser language (locale).


Yes I can target a certain region (in Geo), but not a certain language.


My use case seems rather common:

- my website displays in many language, depending on the browser's language setting.

- my experiment should only apply to one language (as it is a text experiment)

1 Expert replyverified_user

Target Optimize experiment to only a certain language

Google Employee
# 2
Google Employee

I think that you are right that this seems like a feature that should be added.


Still, if you do things properly for your site and set a lang attribute on your page (i.e. on the top html element), you could create a "custom javascript" variable to return it and use this for targeting.


Your "Custom Javascript" variable with name "Page language" that could be like:


function() {

  return document.documentElement.lang;



And then you could do targeting like:

"Page language" equals en-US



Re: Target Optimize experiment to only a certain language

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆



I use a Data layer variable for exactly this purpose.  Language is captured via GTM, then it is easily targeted in Optimize.  Often experiments will be written in English so I use this in my targeting.  This solution works great.