Use helper functions for personalization

Learn how to transform personalization values using personalization helper functions and understand different use cases for helper functions.

Transcript
By the end of this video, you should be able to use Helper Functions to assist in creating personalized content in your Journey Optimizer messages.
When working in personalization, there are times when you may want more control over the display of different attributes. For instance, you may want a particular value to appear in all caps or all lowercase. There may be certain attributes that you want to use for personalization, but you’re unsure if the majority of your profiles will have an existing value for it. So, you may want to insert a condition to first check and see if the value is no. You may want to construct if then conditions where you can change what appears in the message based on the conditional value of an attribute. Another use could be in grabbing a list of items where you want to display values for each. For all of these scenarios and many others you’ll want to use the Helper Functions and the personalization editor. Let’s take a look.
In this example, I have a journey optimizer message that will be sent to a customer if they’ve left some items in their shopping cart, but have not completed the purchase. I’ve noticed that in the design of this message the first name should appear in all caps to match the rest of this section. To ensure that that will happen I’m going to use a Helper Function to transform the name, to always be uppercase. I’ll click the Edit Personalization button. And in the Edit Personalization window, I’ll choose Helper Functions from the dropdown menu. In the search box, I’m going to search for uppercase.
I’ll navigate into the folder and I want to click the information button to learn a little more about this function. I can see that this function will convert a string to uppercase. I’ll go ahead and insert this function, and I’m going to replace the string with the first name value. So, I’ll navigate back over to the file section and search for first name.
And I’ll click plus sign to insert that.
Then I can click save.
Down below I have a section where I want to list the items in the cart. So, I’ll jump into HTML edit mode first, and what I’ll do is I’ll replace any static values with the right contextual attributes.
Let’s see.
Okay, first, I’m going to switch to context and I’m going to replace the Image URL.
Next I’m going to add the total.
I’ll in the product name, and the quantity.
Great, now that I’ve removed the static values with the correct contextual attributes, I want to make sure that I can repeat this block for any products that have been added to the cart.
So, to do that, I’m going to switch back over to Helper Functions. And I’m going to search for the each function.
I’ll click the plus sign to insert the function. And looking at this particular helper, I can see that it’s looking for someArray and variable. someArray is going to be the list that I want to search for, and variable will be the item that I want to repeat. So, I’m going to first get rid of the someArray, and I will replace that with my product list context.
Okay, for the variable I want to actually use product as my main item.
Just remove the dot there, get rid of these.
And the next thing I want to do is I want to take the ending each tag, and I’m going to place it below the bottom of this block.
So that I know this whole item is going to be repeated for each product, this whole section.
Or validate that just to make sure there are no errors, and then I’ll click save.
Another user Helper Functions could be in this block here. So, I want to make sure that the customer sees any special product notes for a particular product. In this case, I want to make sure that the customer knows that if they order the Juno jacket, that there’s a two-week lead time on shipping.
So, I already have my block design with the product notes, I want to make sure that this is only displayed if one of the products in the cart is the Juno jacket. For this, I’m going to use the if Helper Function. Let’s jump back into HTML Edit Mode.
And what I’m going to do is at the top of this block, I’m going to choose Helper Functions and I will search for if.
I’ll click the plus sign to insert the function. And I can see that it’s going to check first for condition.
Then it’s going to give me the option to add the content. And then there’s a follow-up else condition and then a default render followed by a closing if tag. So, what I’m going to do is I’m going to actually remove the multiple else’s, and I’m going to take this and I’m going to select it. And I’m actually going to place it at the bottom of this block.
So, the condition I want to check for is if the product here is the Juno jacket, this has the Juno jacket in their cart. So, I’m going to search for name and add the product name here and I’ll do an equal sign.
Okay, so this is going to say if the product name here is Juno jacket, then go ahead and show this entire block. If not, let’s go ahead and not show anything so the whole block would disappear.
All right, will validate this make sure there are no errors and then I can click save.
All right, that should be it. Let’s take a look at how these Helper Functions worked in my emails. So in this first email, I can see that the customer name Brenda has been transformed to all uppercase and the each function is now showing all the different items that were left in the cart. Because the Juno jacket is not one of these items I am not seeing those special product notes that we had conditionally added to indicate that there was a two week lead time in shipping that particular product.
Looking at this second email, I can see that because the Juno jacket is one of the items in this shopping cart list. I now received the product notes indicating the lag in ship time.
You should now be able to use Helper Functions to assist in creating personalized content in your Journey Optimizer Messages. -

See the product guide to learn more about helper functions.

recommendation-more-help
7e382214-bd30-4de2-bc8b-f6f6e7182305