Event Look Ups

Overview for Trigger Event Object

For content being sent from a trigger campaign, an event object is available to populate information in content from the event that triggered the campaign. The properties available in the event are the same properties passed in the payload of the event. Take the following purchased event as an example.

Purchased Event Payload

{

"session": "afb35e24-37a9-40b4-96e5-7eb937c064e5",

"last_purchase":

{ "items": [

{

"productsku": "J9834RHJ",

"productname": "Some Cool Pants",

"quantity": 1,

"price": 45.68

}

],

"total": 45.68,

"cartuserdata": {

"first_name": "Ryan",

"last_name": "Malone",

"email": "rmalone@zetaglobal.com"

}

}

}

To populate the productname information from the first item in this purchased event we can use the following event object.

Input

You bought: {{ event.purchased.last_purchased.items[0].productname }}

Output

You bought: Some Cool Pants

Event Look Up Tag

Multiple past events can also be used in content using an event look up tag.

The following example creates a variable called purchases as an array of the last three purchase events for the given user_id the message is being created for. The full contents of the array can be viewed in content using {{purchases}}, or use a for loop to iterate over the array to find the details you need.

Input

{% event purchases | event_type: 'purchase' | count: 3 %}

The event_type parameter can be changed to retrieve events of the specified name. The count parameter sets the limit for the number of past events that should be retrieved.