The Emarsys Relational Data Service (RDS) enables you to load your business-specific data to the Emarsys platform, in order to use it for segmentation and message personalization purposes. For a detailed overview about Relational Data, visit this link.
How can you use Relational Data with ESL?
Relational Data (RD) is basically data stored in either your own database or in Emarsys hosted databases. When you create a campaign in which you would like to personalize with RD, you pull data from these databases. You can do this via creating RD tokens, which you can insert into your campaigns and when sent, they will be populated with the actual data.
To set up an RD token, that will display a single value, you need to have:
- an RD connection through which data will be pulled,
- the actual table where the data is located,
- the type of data you would like to reference, for example: first name, email address, birthday, pet name, etc.,
- the number of the row where the data can be found,
- the column of the table.
Learn more about how you can onboard your database to Emarsys via Relational data.
All the above information will be used to create the RD Personalization token with the following format:
Example
{{ rds.Connection_name.avcwiseTable(ben@xyz.com)[0].PetName }}
Where:
-
rds
- The type of token -
Connection_name
- Relational Data connection -
avcwiseTable
- Relational Data table from where we will pull the data -
ben@xyz.com
- The actual data you would like to reference, this can be any other contact datafield as well for example (contact.1) -
(0)
- The number of row in the table where the data can be found -
PetName
- The column of the row you would like to reference
In the following screenshot, you can see a first name and a pet name RD Personalization token written in ESL in the VCE Editor.
This is how the RD personalization tokens look like in the Contact Preview:
Learn more about Relational Data Tokens.
How to use RD data with the foreach loop
The following example will return a single value: Harvey.
{{ rds.Connection_name.avcwiseTable(ben@xyz.com)[0].PetName }}
You can also list multiple values related to a reference field (you can specify the number of values to be displayed).
In the following example, there are multiple holiday destinations in the RD table saved for the contact.
{% foreach item in rds.Connection_name.travel_destination(contact.3) %}
{{ item.destination }}
{% endforeach %}
The ESL code above will display all the holiday destinations that can be found in the RD table for a certain contact.
This is how the campaign will look like in the Contact Preview:
You can specify the number of destinations you would like to display.
{% foreach item in rds.Connection_name.travel_destination(contact.3) limit 2 %}
{{ item.destination }}
{% endforeach %}
This is how the campaign will look like in the Contact Preview:
You can choose from 2 options to reference contact data in RD. In the following example, we have used Contact data but Event data can be used as well. Other ESL features cannot be used as reference.
{{ rds.Connection_name.product_recommendation(contact.3)[0].title }}
{{ rds.Connection_name.product_recommendation(event.last_purchased.email)[0].title }}
To see more Relational Data examples with ESL, visit this link.