Event data in emails

Pass through the data you send over events to the email you are sending.

Usage

To get event date inside your email, you'll be required to use Django tags.

These tags will be rendered as a text as user receives the email. Below you can find example code to use in your email messages.

UPDATE

Sending event data to you cusomters has been improved. From now on, you can pick each key value that you send through event. See example below.

userengage('event.event_name', { foo: 1, bar: 2 })

This event, could be sent via email as follows:

{% events 'event_name' for_last_days=7 count=100 order=1 as events %}
{% for event in events %}
  FOO = {{event.foo}}, BAR = {{event.bar}}
{% endfor %}

The content of the email would look similar to this:

FOO = 1, BAR = 2

Just put the code in your email message, change to event_name and we'll do the rest!

Lines of code described

{% events 'event_name' for_last_days=7 count=100 order=1 as events %}

event_name is the name of your event.

for_last_days is the number of days for last occurance of this event. Default is 30.

count is the number of last X events fired. Default 10

order for descending order, set negative number -1, and for ascending order set positive number 1. Default -1

FOO = {{event.foo}}, BAR = {{event.bar}}

{{event.foo}} will output the value of foo key in your event. Same goes with {{event.bar}}

{% for event in events %}

for is commonly used name to loop through objects and arrays.