Use related data to create a personalization and insert the related data into a message.

You can use a placeholder to insert individual data into a message with the data that are stored in related data sets (see ​Inserting Data From a Related Data Set Into a Message​).

Personalization rules must be created manually.

Construction of a Personalisation Rule (InsertIf)​

You cannot create personalization with the visual interface (personalization slider) of Mapp Engage to access related data through the ​Personalization Builder (wizard). You must create the personalization manually. The syntax for personalization with related data differs from the syntax for personalization with data from attributes. The personalization rules can, however, be saved in the code view of the personalization builder, which makes it easy to reuse the rules.


<%InsertIf expression="${function}"%>Text<%/InsertIf%>
  • The InsertIf tags define the beginning and end of the personalization.
  • expression="" contains the rule for personalization.

  • function: The function is the rules that determine when the content is inserted into the message. The result of this filter or function must be a Boolean value (True or False). If the function itself does not produce a Boolean value, an additional CountMapElement function must be used to generate a Boolean value from the actual function (see example 1).

Alternative to the personalization rule (Insert-Else)​

<%InsertElse expression="${function}"%>Text<%/InsertElse%>

The InsertElse tag defines the personalized content that is displayed as an alternative to the above InsertIf rule. If the first personalization rule (the InsertIf tag) applies, the InsertElse personalization is disregarded. The construction of the InsertElse tag is identical to the construction of the InsertIf tag.

The default content for when the above personalization rules do not apply:

<%InsertElse%>Text<%/InsertElse%>

An InsertElse tag that contains no rule is the default content. This content is shown when none of the already defined personalization rules (InsertIf or InsertElse) apply.

Examples​

Customer purchases are saved in a related data set with the name ​Purchases. The key for this related data set is the customer ID number. "Purchases" contains a column of data that is called ​ArticleType. This data column contains the category of goods of a certain purchase. The related data set is linked to an attribute that also contains the customer ID numbers. Purchases are thus clearly linked to the respective customer by the customer ID number.

Example 1

Send a special offer to all customers who have purchased shoes.
The InsertIf statement is constructed as follows:

<%InsertIf expression="${ecm:countMapElements(ecx:filter(user.RelatedAttribute['Purchases'], 'ArticleType', '==', 'Shoes'))>0}"%> Text <%/InsertIf%>
CODE
  • The ecx:filter filters according to a specific entry (see ecx:filter​). The result of this filter is all entries with the value Shoes.

  • The filter produces entries with the value "Shoes", but in fact, this entry requires a Boolean value. Add the additional function .Personalisation with Related Data v1.0 to generate Boolean values.

  • The text of the offer is then displayed in the message only when the filter finds the value "Shoes" in the purchase history of the recipient.

Example 2

In addition to the offer for shoe purchasers (example 1), send a further offer to all customers who have made a purchase in the last month. The date of the purchase is saved in the column Date in the related data set Purchases.
The personalization rule is constructed as follows:

<%InsertIf expression="${ecm:countMapElements(ecx:filter(user.RelatedAttribute['Purchases'], 'ArticleType', '==', 'Shoes'))>0}"%> Text1 <%/InsertIf%>
<%InsertElse expression="${ecm:countMapElements(ecx:filter(user.RelatedAttribute['​Purchases​'], 'Date', '>=', ecx:formatDate(ecm:addInterval(date.today, '-1M'), 'yyyy-MM-dd', ecm:timeZone('Europe/London'), '', false)))>0}"%> Text2 <%/InsertElse%>
CODE
  • First, insert the InsertIf statement that you constructed in example 1.
  • The InsertElse statement defines the rules of the alternative offer, that is, the time frame in which the purchase was completed (​ecx:formatDate​). As this function does not produce a Boolean value, either, we again need to add an ecm:countMapElements function.

Example 3

A third offer is displayed for all customers to whom neither of the above rules applies. As the default is constructed without defining a rule, we do not need to use a function. Thus, the entire expression (including the personalization rules that are created in examples 1 and 2) reads as follows:

<%InsertIf expression="${ecm:countMapElements(ecx:filter(user.RelatedAttribute['Purchases'], 'ArticleType', '==', 'Shoes'))>0}"%> Text1 <%/InsertIf%>
<%InsertElse expression="${ecm:countMapElements(ecx:filter(user.RelatedAttribute['​Purchases​'], 'Date', '>=', ecx:formatDate(ecm:addInterval(date.today, '-1M'), 'yyyy-MM-dd', ecm:timeZone('Europe/London'), '', false)))>0}"%> Text2 <%/InsertElse%>
<%InsertElse%>Text3<%/InsertElse%>
CODE