How to target on browser Language using Expression Targets?

Avatar

Avatar
Validate 1
Level 1
xbarcelona
Level 1

Like

1 like

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
xbarcelona
Level 1

Like

1 like

Total Posts

4 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
xbarcelona
Level 1

15-10-2015

Hi there

I want to target base on browser language (ex. German) but are not sure how to create a correct Expression-Target for this?

Not sure if user.header or user.browser should be used and how the correct syntax should look like? Then there is also user.header('accept-language') and user.header('accept') which both seem to fit somehow?

I created these 3 Expression Targets but am not sure about which one is correct?

1.return user.header('accept-language')=="de";

2.return (user.header.indexOf('de') != -1);

3. return (user.browser.indexOf('de') != -1);

 

thanks for your help.

Nicolas

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 25
Employee
shekhardhiman
Employee

Likes

51 likes

Total Posts

688 posts

Correct reply

330 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
Employee
shekhardhiman
Employee

Likes

51 likes

Total Posts

688 posts

Correct reply

330 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
shekhardhiman
Employee

15-10-2015

Hi Nicolas,

Thank you for reaching out to Adobe Community.

I would request you to kindly try and use the below code and see if it helps:

return user.header('accept-language').indexOf('de') > -1

Thanks!

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 1
gylesf73140248
Level 1

Likes

4 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
gylesf73140248
Level 1

Likes

4 likes

Total Posts

6 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
gylesf73140248
Level 1

02-10-2017

Hello,

I am trying to do something similar, but with language and locale.

What exactly does the user.header('accept-language') get?  usually the accept language has locale and factor weighting included.  Accept-Language - HTTP | MDN

for example if i wanted to create a profile script differentiating england from united states for english, i would need to parse the language and locale.   would the user.header("accept-language") give me "en-gb" or "en-us"?

Does using console.log work for debugging these scripts?  It is difficult to use the built in target parameters without know exactly what it provides.

any help would be much appreciated!

Gyles Fohl

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

93 likes

Total Posts

817 posts

Correct reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

27-06-2017

Hi Mike,

Thanks for reaching out to Adobe Target community .

Can you please let us know the browser language on which you want to base your targeting activity?

Regards

Parit

Avatar

Avatar
Level 1
TheQuinn
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
TheQuinn
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
TheQuinn
Level 1

23-06-2017

Do you know when this list of languages will be increased as it is incredibly restricted.

Screen Shot 2017-06-23 at 14.04.29.png