Personalization Rule Examples

Prev Next

Overview

This article collects worked examples of InsertIf/InsertElse rules and content blocks. Use them as templates for common personalization patterns. The examples are shown as code, as they appear in Code View. For the syntax, see Personalization Rules Syntax. For the settings of the Builder, see Personalization Builder: Create and Edit.


Examples

Salutation with capitalized name

These placeholders insert the recipient's first and last name with a capital first letter. Use them in a content block, for example in the block for male recipients of a gender-based greeting. For the function, see Format and Encode Strings.

Dear Mr. <%${ecx:capitalizeFirstLetter(user['FirstName'])}%> <%${ecx:capitalizeFirstLetter(user['LastName'])}%>

Loyalty program progress

This rule shows recipients how many points they need for the next loyalty level. Recipients without points receive an invitation to join the program. All blocks belong to one rule, so Mapp Engage inserts only the content of the first block whose condition is true.

<%InsertIf expression="${empty user.CustomAttribute['Loyalty_Points']}"%>
Register for Our Loyalty Program to Receive Valuable Rewards!
<%/InsertIf%>
<%InsertElse expression="${user.CustomAttribute['Loyalty_Points'] < 1000}"%>
<%${1000 - user.CustomAttribute['Loyalty_Points']}%> Points to Reach Silver!
<%/InsertElse%>
<%InsertElse expression="${user.CustomAttribute['Loyalty_Points'] < 5000}"%>
<%${5000 - user.CustomAttribute['Loyalty_Points']}%> Points to Reach Gold!
<%/InsertElse%>
<%InsertElse expression="${user.CustomAttribute['Loyalty_Points'] < 10000}"%>
<%${10000 - user.CustomAttribute['Loyalty_Points']}%> Points to Reach Platinum!
<%/InsertElse%>
<%InsertElse%>
Congratulations, You Have Reached Platinum!
<%/InsertElse%>

For a use case based on this example, see Using a Loyalty Program to Increase Revenue.

Capitalized first name in the subject line

This rule inserts the recipient's first name with a capital first letter into the subject line. If no first name is stored, a default subject is used. Write the rule in one line, because the subject line is a single line of text.

<%InsertIf expression="${not empty user['FirstName']}" id="Subject_FirstName"%><%${ecx:capitalizeFirstLetter(user['FirstName'])}%>, your weekly offers are here<%/InsertIf%><%InsertElse id="Subject_Default"%>Your weekly offers are here<%/InsertElse%>