Guides & Tutorials

Personalizing dynamic content in newsletter

Dynamic content personalization

In templates you can personalize even more information than just your customer’s name. You can also personalize entire content blocks depending on your contact’s preferences and other added information. For example you can show content depending on their language, show product categories depending on customer’s choices or preferences, show content based on their personal trainer/personal agent and so much more.

To create this solution, you need to add a HTML element before and after the content that is going to be personalized. Inside the first HTML element add an if-clause like this:

{% if custom_parameter_name == "value_given" %}

This means that if the contact has the same value in the given parameter, then they will see the following content.

At the end of the content add the end tag in the HTML element to close the personalized content part.

{% endif %}

With this method you can add as much personalized content as needed.

Below are some examples on how to create dynamic personalized content in templates.

Examples

Personalized elements – personal trainer blocks

In this example, each contact has a personal trainer name added to their contact information (parameters) in Smaily. Depending on the trainer’s name each contact will see a personalized trainer block in their newsletter.

Personalized text – “view in browser” in multiple languages

In this example, each contact has a language preference and they see the newsletter elements in that language.

Personalized content – personal agents

Similar to the personal trainer example, in this template we can see customized agent blocks in the template. Each recipient will see only their sales agent (depending on the parameter value added to the contact).

Personalized content – categories based on preferences

In this example, contact has chosen their preferred book interests and this information has been imported to Smaily. It is possible to create a long newsletter with all the categories, but show to each recipient only their preferred ones. Depending on how the parameters and values were added to the contact, it is possible to show multiple blocks.

Personalizing text via API

You can also personalize content via API. In this case you need to give all the information needed for the personalization with the request using a parameter. Here is an example snippet from the request, where the “notices” parameter is used to personalize the template:

{
  "notices": "<ol><li>Teie ettevõte on valitud küsimustiku INTRASTAT 2021 valimisse. Küsimustiku esitamise tähtaeg on 10.10.2022Teie ettevõte on valitud küsimustiku INFOTEHNOLOOGIA 2021 valimisse. Küsimustiku esitamise tähtaeg on 10.12.2022</li><li>Teil on tähtajaks esitamata küsimustik PALK 2020. Küsimustiku esitamise tähtaeg oli 10.07.2021</li></ol>"
}

The template uses default text and the parameter to be personalized. Example:

Note! The size of the context provided in the API request cannot exceed 120KB.