Personalizing push messages
The Mobile Engage personalization feature allows you to personalize push messages for known users with contact-level data and external event data. For more information, see Omnichannel personalization - Overview.
Where fieldID
is the numeric ID of the Emarsys contact database field. You can use any system or custom field for personalization.
External event personalization
You can send external events which will trigger Interactions programs and send out push messages. External event personalization is added using the convention:
{{ event.key }}
Where key
is in the global section of the JSON object.
Example
Here is an example API request for external event personalization:
{
"key_id": "153345",
"external_id": "t.odinsson@example.com",
"data": {
"global": {
"hero_first_name": "Jessica",
"hero_second_name": "Jones"
}
}
}
You must include the keys in the editor to use the values for personalization:
Hey {{ event.hero_first_name }} {{ event.hero_second_name }}! Brace yourself, winter is coming.
Please note that external events can also be tested via the Emarsys API demo. To access the demo environment, please visit https://api.emarsys.net/api-demo.
Personalizing with mobile custom events
It is possible to personalize push messages, by using the attributes sent with mobile custom events. Please make sure that you add the prefix {{ event_attributes. }}
to the attributes name, otherwise the specified attribute will be invalid.
If you would like to personalize the content with event details in campaigns using Mobile events, then enclose them as follows:
{{ event.event_attributes.yourCustomAttribute }}
Example
For example, you can provide the name of a store within a push notification. Include the store name as an attribute within the event payload. Then it is possible to personalize with JSON payload :
{{ event.event_attributes.store_name }}
As another example, you can use product information (e.g. name, image, etc.) in your push messages for personalization as follows:
Emarsys.trackCustomEvent(
eventName: "item_view",
eventAttributes: [
"id": "2054",
"name": "BestRun Men Jeans 3/4 Straight - Blue",
"img_url": "http://bestrun.com/pub/media/catalog/product/m/j/mj006.jpg"
]
)
- You can build an Interactions program starting with the Mobile event that:
- is triggered when a contact views a product (i.e. this action will generate an item_view
event that triggers your program) and
- sends a push message to the contact.
It looks like as follows:
- Create a push message and add the
{{ event.event_attributes.name }}
personalization variable to its content.
- Click the Image icon and add the
{{ event.event_attributes.image_url }}
personalization variable to the iOS image field and check the Use same url in Android checkbox.
For more information, see Interactions - Event payload examples.