Simple FreeMarker Examples for Personalizing Emails

This post was originally published on this site

If you are in marketing, you probably have heard a lot about personalization in email marketing. Personalization is all about identifying characteristics of your recipients that are relevant to the email you want to send and then customizing that content with the most relevant data. It could be a recipient’s name, the city where they live or even their favorite food – you are only limited by the information you have in your CRM. This is known as dynamic content, and in ClickDimensions, dynamic content is done with FreeMarker.

Before using FreeMarker in your ClickDimensions email templates, make sure that you have gone to Settings > ClickDimensions Settings and published your metadata. This publishes your customizations to ClickDimensions so that your custom fields will appear in the personalization menu.

The personalization menu in ClickDimensions email editors will generate FreeMarker that looks something like this (your field’s schema name may vary): ${Recipient.contact.new_profilelink[0]!””}

Here are some examples of simple references that can be made using the personalization button.

Freemarker in Template Rendered Message
Hello, ${Recipient.FirstName}!

Hello, Sam!

I see your favorite

color is ${Recipient.FavoriteColor}

I see your favorite color is

Blue.

${Recipient.contact.firstname[0]!

“Valued Customer”}

Dear Valued Customer (if no data is available)
You were born on ${Recipient.contact.birthdate[0]?string[“dd.MM.yyyy, HH:mm”},

Happy Birthday!

You were born on October 16th 1988 at 4:08am,

Happy Birthday!

This month’s campaign is

${Recipient.cdi_emailsend.cdi_

Campaignid[0]””}

This month’s campaign is Campaign 003

 

 

Good Morning, ${Recipient.contact

.contactid.contact.title}${Recipient.LastName}!

Good Morning, Dr. Anderson

Another way to use FreeMarker is using if, else if and else statements, known as conditional statements. You can use if, else if and else directives to conditionally skip a section of the template.

For example, if you wanted to create a template in a different language based on what a contact’s language preference is, you can assign that information.

FreeMarker in Template – Here is an example of how to assign a language into your content depending on the data in the field.
<#assign x=Recipient.contact.ava

_langcode[0]!”Null”/>
<#if x==”de-DE”>
DEUTSCH
</#if>
<#if x==”it-IT”>
ITALIANO
</#if>
<#if x==”es-ES”>
ESPANOL
</#if>
<#if x==”fr-FR”>
FRANCAIS
</#if>
<#if x==”Null”>
ENGLISH
</#if>

FreeMarker in Template – Here is an example of how to assign gender into your content.

<#assign gender=Recipient.contact.gendercode[0]!”null”/>
if gender==”Male”>
Her
<#elseif gender==”Female”>
Him
<#elseif gender==”null”>
Friend
</#if>
<#elseif language==”English”><#if gender==”Male”>
Mr.
<#elseif gender==”Female”>
Ms.
<#elseif gender==”null”>
Friend
</#if></#if>

Happy Marketing!

The post Simple FreeMarker Examples for Personalizing Emails appeared first on ClickDimensions Blog.

Check Also

5 Pardot Things B2B Marketers Won’t Want to Miss at Dreamforce ’17

This post was originally published on this siteAttention B2B Marketers: if you’re headed to Dreamforce …

Leave a Reply

Your email address will not be published. Required fields are marked *