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.
Thanks for your questions! Using console.log is not an option because this is not js that gets executed in the page, it is js that is executed server side, when the mbox call comes in. The user.header ("accept-language") would give you "en-gb" or "en-us" because it captures whatever the browser sends as its language header. In most cases you should get the en-gb or en-us coming though.
There is no way to debug profile scripts, though you can try to write out the value of the profile script in an Offer using token replace and then view the value of the profile script, which may be helpful.
Running into the same issue we solved that by using the Accept language setting in Adobe target
Site Pages: HTTP Header Accept-Language startsWith
above to target all Chinese language packages. This will also trigger with zh_TW, zh, zh-CN,... a.s.o however this method seems to be not able to take the preferred language weighting into account (so the `startsWith` is not really respected and behaves like `contains`)
Thanks for sharing this experience with the community - appreciate this suggestion! The good thing about discussing it here is that you're probably not the only one that might be interested in this!
To that end, would you mind posting this as a "New Idea" using the "Submit an Idea" link on the right of the page (orange lightbub icon)? This way, other community members can vote up on this idea, and it can then be suggested to the product team.
This does not address the original question unfortunately. I had tried going this route originally but because those options are so limited it was of not helpful.
There are only about 10 languages, for example there is no Italian or traditional chinese. Also, the language options do not distinguish locale, which accept-header does. from original post: "en-gb" or "en-us".
I would recommend adding more languages and options for locale.