0

In our localized product recommendation display we want the button text to have the language in which the recommendation is rendered. I've written some Einstein AMPscript to capture the countrycode of the URL, which I want to base the button text language on. The code looks like this:

ProductLinkSplit.At2Split/At0

This works fine, when I output it onto the display it returns nl, de, co.uk, etc. However when I want to compare this value to the string value "nl" for instance, the condition doesn't go the path I expect. I suspect this has something to do with the way I compare the string, this is the complete conditional statement:

%%[if ProductLinkSplit.At2Split/At0 == 'nl' then]%%
Bekijk
%%[else]%%
View
%%[endif]%%

The link in the preview contains a "nl" so this statement should return "Bekijk". However, when I change the "nl" in the string comparison with "de" the condition still returns "Bekijk" when it should return "View". I've tried putting the nl between double quotes or without quotes at all, but it still doesn't work. Does anyone has any experience with this and is able to help me out? Thanks

2 Answers 2

2

ProductLinkSplit.At2Split/At0 is formula.

If you'd like to compare something in if statement you need to save the variable in product catalogue as new attribute. According to https://help.salesforce.com/articleView?id=mc_pb_ampscript_functions_for_email_recommendations.htm&type=5

Operators where A and B can be a:

  • string
  • float
  • product attribute or exact name from your catalog, such as %%WidthInInches%%

So either localization as EasyE says or new attribute

1

I would recommend using localized fields. Then in the rec call you would pass ?locale=nl-nl to pull the display for the correct locale

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .