How to personalize messages

Send messages with information gathered from users

Personalization based on lead properties

To make your messages more personal, add lead properties (such as name, city, etc.) to the message. There are two property types in Dashly: system properties and custom properties. System properties are present in your dashboard by default. You can find the full list of system properties in our documentation.

You can collect any lead properties via API and “Visitors data tracking” section. You can also add them manually right in the lead card.

Here’s a few examples of how you can personalize your messages:

1) Hello,   {{ user['$name'] | default('Dear customer') }}  

The  user['$name']  part of the code inserts the value of the “Name” property into the text of your message. Notice the  default('Dear customer')  part of the code. It inserts “Dear customer” into the text if the “Name” property is not defined in a recipient lead card.

2) Your order amount is $ {{user ['cart amount']}} . Do you wish to finish your order?

If the order amount is $100, the lead will see the following text: "Your order amount is $100. Do you wish to finish your order?"

Personalization based on event properties (abandoned carts)

To add viewed or added to cart items you need to set up data collection via JavaScript or Web API. All data added to the email will be taken from event properties.

Once data collection is configured, "Item viewed" and "Added an item to the cart" events will start appearing in lead cards.

If data collection is configured, let's move to creating the triggered message.

1) Add the code to the HTML-code of your email. This code will be inserting 20 last items added to cart into the email (these items won't be duplicating in the email):

The code for viewed items:

{% set massViewed = [] %}
{% set massViewedName = [] %}
{% for e in get_last_events('$product_viewed') %}
{% if e.props['$name'].lower().strip() not in massViewedName %}
{% set x = massViewed.append(e) %}
{% set x = massViewedName.append(e.props['$name'].lower().strip()) %}
{% endif %}
{% endfor %}

The code for items added to cart:

{% set lastDateCompleted = 0 %}
{% if get_last_events('$order_completed') | length > 0 %}
{% set lastDateCompleted = get_last_events('$order_completed')[0]['created'] %}
{% endif %}
{% set massOrder = [] %}
{% set massOrderName = [] %}
{% for e in get_last_events('$cart_added') %}
{% if e['created'] > lastDateCompleted %}
{% if e.props['$name'].lower().strip() not in massOrderName %}
{% set x = massOrder.append(e) %}
{% set x = massOrderName.append(e.props['$name'].lower().strip()) %}
{% endif %}
{% endif %}
{% endfor %}

When composing the HTML, do not forget to wrap it into the “div” tag with the “style: none” attribute so that the code itself is not displayed in the email.

2) Run a loop which will add data from the created array:

The code for viewed items:

{% for b in massViewed %}
{% set link = b.props['$url'] %}
{% set img = b.props['$img'] %}
{% set name = b.props['$name'] %}

The code for items added to cart:

{% for b in massOrder %}
{% set link = b.props['$url'] %}
{% set img = b.props['$img'] %}
{% set price = b.props['$amount'] %}
{% set name = b.props['$name'] %}

After that, you’ll need to add a block with items inserted by corresponding variables: {{link}}, {{name}}, {{price}}, {{img}}.


<img src="{{img}}">

<a href="{{link}}">{{name}}</a>

<span>{{price}} rub.</span>

After this block add the following:

{% endfor%}

to complete the cycle.

Powered by