Search through more than a hundred articles on every aspect of User.com

Dawid Tyburek
Written by Dawid Tyburek

Product events - rendering in emails

Learn about product event tags and how to use them


What you should use them?

Use these snippets when you want to insert information about specific products (e.g. viewed or bought) into your messages to customers. To find out more about snippet tags, you can check this article.

  • One of the most popular uses of Product Event rendering is recovering an Abandoned Cart. You can build an automation that will gather Customers who added product to cart and send them a reminder if they don't buy it. Every customer will receive the message with the exact product they added to the cart!
  • If you work in the Real Estate field, product events will be very useful for you to remind your customers which properties the have searched for. Remember you can add photos in the event rendered in emails to make it a real attention catcher!

Example:

{% product_events for_last_days=100 count=100 order=-1 event_type='add to cart' category='my_category_1,my_category_2' as events %} 
{% for event in events %} {{ event.attribute_1 }}, {{ event.attribute_2 }} {% endfor %}
  • The first part of the code defines which products you want to select. In this case, the code would return a maximum of 100 products (count) from the categories my_category_1 and my_category_2 (category) that were added to cart (event_type) within the last 100 days (for_last_days). The order "-1" stands for "from newest to oldest".
  • The second part of the code defines what information about the products (in the form of attributes) will be shown to your recipient. In this case, you would show values of attribute_1 and attribute_2.


Below, you can see descriptions of all the filters you can use in the code mentioned above to determine which products you want to select.

  • for_last_days - how many days in the past should be taken into account
  • count - the maximum number of products returned
  • order - use "-1" to list products from newest to oldest events, and "1" to list from oldest to newest
  • event_type - product events of the type you want to consider (full list of available types can be found below)
  • category - define which categories should be taken into account; categories should be listed by name and separated with a colon, without any spaces

List of available event types:

  • add to cart
  • purchase
  • liking
  • add to observation
  • order
  • reservation
  • return
  • view
  • click
  • detail
  • add
  • remove
  • checkout
  • checkout option
  • refund
  • promo click

Important note!

If this tag is used multiple times inside a template, the 'as' variable name must be different.

{% product_events ... as events1 %} {% for ... %} ... {% endfor %}
{% product_events ... as events2 %} {% for ... %} ... {% endfor %}

Remember

It is always a good practice to test your email by sending it to yourself just like you would send it to your Users. This way you can check any styling or code mistakes that might have been overlooked in the creation process.

  • Create a new Email Campaign
  • Choose an already created email, prepared to your Users
  • Send it only to yourself or your Team as well to fully know how your message will behave on different email clients.

Related articles


Categories: