Voucher assignment based on average basket value

Published December 21, 2022
Modules
Difficulty

Most marketers know that vouchers in line with your customers’ shopping habits are one of the best ways to turn a visit into a sale. Sending an email with a relevant discount coupon to customers who have not purchased in a while will be great to re-engage them. You can personalise the communication and drive extra revenue for your business by grouping your customers by their average order value and offering them a better-tailored offer. Directing vouchers to the right audience at the right time will be more effective than sending irrelevant offers to all your customers. In this use case, you will create an automation that sends an email communication with a dedicated voucher code to a specific segment of customers with two or more transactions, depending on their average order value (AOV). The workflow is triggered when customers’s session on the site ends, and will only continue for those customers who meet all the conditions defined in the segmentation and have not made any purchase in the last 30 days.

The promotional graphic for the use case

Prerequisites


Process


In this use case, you will go through the following steps:

  1. Create an aggregate for calculating AOV.
  2. Create an aggregate for counting transactions.
  3. Create a segmentation based on the aggregates to set an audience for use in communication.
  4. Create an expression that will be used in an e-mail template to check which segment the customer is in.
  5. Create an email template with jinjava code that inserts a voucher code depending on the customer’s segment.
  6. Create a workflow that will send emails with vouchers to a specific segment of customers.

Create an aggregate for calculating AOV


In this part of the process, create an aggregate that returns AOV from transaction.charge event.

  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Average.
  5. From the Choose event dropdown list, select the transaction.charge event.
  6. As the event parameter, select $totalAmount.
  7. Define the period which the aggregate will analyze. In this use case, it is Lifetime.
  8. Save the aggregate.
The view of the configuration of the avarage order value aggregate
Configuration of the AOV aggregate

Create an aggregate for counting transactions


In this part of the process, create an aggregate that returns number of transactions.

  1. Go to Analytics icon Analytics > Aggregates > Create aggregate.
  2. As the aggregate type, select Profile.
  3. Enter the name of the aggregate.
  4. Click Analyze profiles by and select Count.
  5. From the Choose event dropdown list, select the transaction.charge event.
  6. Define the period which the aggregate will analyze. In this use case, it is Lifetime.
  7. Save the aggregate.
The view of the configuration of the aggregate returning number of transactions
Configuration of the aggregate returning the number of transactions

Create a segmentation


In this part of the process, create a segmentation that contains two customer target groups who made at least two transactions. First for customers with AOV less than 200 PLN and second for customers with AOV equal or greater than 200 PLN.

The names of the segments will be used as variables later, so enter them as exactly as instructed.

  1. Go to Profiles icon Analytics > Segmentations > New segmentation.

  2. Enter the name of segmentation.

  3. Rename Segment A to AOV < 200 PLN

  4. From the Add condition dropdown list, select the aggregate for AOV you created in the previous step.

  5. As the operator, choose Less than for number.

  6. In the text field, enter 200

  7. From the Add condition dropdown list, select the aggregate for counting transactions you created in the previous step.

  8. As the operator, choose More or equal to for number.

  9. In the text field, enter 2

    The view of the configuration of the segmentation for AOV less than 200 PLN
    Configuration of the segmentation for AOV less than 200 PLN
  10. Click Add segment next to the first one. Name the new segment AOV >= 200 PLN

  11. From the Add condition dropdown list, select the aggregate for AOV you created in the previous step.

  12. As the operator, choose More or equal to for number.

  13. In the text field, enter 200

  14. From the Add condition dropdown list, select the aggregate for counting transactions you created in the previous step.

  15. As an operator, choose More or equal to for number.

  16. In the text field, enter 2

  17. Save the segmentation.

The view of the configuration of the segmentation for AOV more or equal to 200 PLN
Configuration of the segmentation for AOV more or equal to 200 PLN

Create an expression


In this part of the process, create an expression which will be used to return the customer’s segment in the segmentation created in the previous step. It will be used later in the email template and will allow us to target vouchers appropriately - to the right group of customers.

  1. Go to Analytics icon Analytics > Expressions > New expression.
  2. Enter a meaningful name of the expression.
  3. Leave the expression type at default (Attribute).
  4. Build the formula of the expression.
    1. Click the Select node.
    2. From the dropdown list, select Profile.
    3. Click the unnamed node.
    4. From the Choose attribute dropdown list, select the segmentaion created in the previous step.
  5. Save the expression.
The view of the configuration of the expression for definig in which segment is the customer
Configuration of the expression

Create an email template


In this part of the process, create an email template with a Jinjava code which uses the results from the expression created in the previous part of the process to check the customer’s segment and assign a voucher code from the corresponding pool.

  1. Go to Image presents the Communication icon Communication > Email.

  2. On the left pane, click Templates.

  3. Select the wizard:

    • Drag&drop builder - use ready-made components to build an email template.
    • Code editor - use HTML, CSS and JS to build an email template from scratch.
  4. Build a template.

  5. Add the Jinjava code presented below.
    This code includes a context of the node from the workflow you will create in the next part of the process. Thanks to this context, the latest results of the expression will be used in the email template to select the voucher pool corresponding to the customer’s segment. You can change the text of the messages in the code according to you business needs.

    1. Replace the UUID after expressionvar with the ID of the expression you created earlier.
    2. Replace the UUID in the first voucher tag with the ID of the voucher pool with vouchers for customers whose AOV is less than 200 PLN.
    3. Replace the UUID in the second voucher tag with the ID of the voucher pool with vouchers for customers whose AOV is 200 PLN or more
    Check the Jinjava code

    {% expressionvar 2bf51517-ae79-4bfb-bd37-153408c80bf5 %}
        {% set state = expression_result %} 
        {% if state == 'AOV < 200 PLN' %}
         Buy discounted products from the online shop with an extra 10% discount! You can find your personal code below <p>
        {% voucher assign=false %} f017803f-4d5c-4192-aa3a-f845822490cb {% endvoucher %}
        {% elif state == 'AOV >= 200 PLN' %}
        Buy new collection products from the online shop with a 20% discount! You can find your personal code below. <p>
        {% voucher assign=false %} 8464b593-478c-412a-9dfb-0aab59f8ff5e {% endvoucher %}
        {% endif %}
    {% endexpressionvar %}
        

  6. Save the template.

Create a workflow


In this part of the process, you will create the workflow which sends emails with vouchers to a specific segment of customers, triggered when they finish their session on the site. The voucher will be sent maximum once a month, to customers who didn’t make a purchase in the last 30 days.

  1. Go to Automation icon Automation > Workflows > New workflow.
  2. Enter the name of the workflow.
  3. Click Set capping and define the limit of workflows a profile can start:
    1. Set Limit to 1.
    2. Set Time to 30 days.
  4. Confirm by clicking Apply.
The view of the configuration of the workflow capping
Configuration of Workflow capping

Add the Profile Event node

  1. Click Add trigger.
  2. From the dropdown list, select Profile Event.
  3. Click the node.
  4. From the Choose event dropdown list, select session.end.
  5. Confirm by clicking Apply.

Add the Delay node

Add the Delay node to define the lag between the session.end event and sending an email with voucher to specific segment of customers. In this example it is 1 hour.

  1. Click MATCHED.
  2. From the dropdown list, select Delay node.
  3. Click the node.
  4. Set Time of delay to 1 hour.
  5. Confirm by clicking Apply.

Add the Profile Filter node

  1. Click THEN.
  2. From the dropdown list, select Profile Filter node.
  3. Click the node.
  4. From the Choose filter dropdown list, select the expression created in the previous step.
  5. From the Choose operator dropdown list, select Is true.
  6. Add another condition by clicking the Choose filter dropdown list and selecting the transaction.charge event.
  7. Click Profiles matching funnel and change it to Profiles not matching funnel.
  8. Click the calendar icon in the right lower corner to change the date range.
    1. In the Relative date range section, select Custom.
    2. Set to Last 30 days.
    3. Confirm by clicking Apply.
  9. Confirm by clicking Apply.
  10. At the NOT MATCHED path, add the End node.
The view of the configuration of the Profile Filter node
Configuration of the Profile Filter node

Add the Send Email node

  1. Click THEN.
  2. From the dropdown list, select Send Email node.
  3. In the Sender details section, choose the email account from which the email is sent.
    1. In the Content section:
    2. Select the template that you prepared in the previous step.
    3. Add the subject of the email.
  4. You can define the UTM parameters in the UTM & URL parameters section.
  5. In the Additional parameters section, optionally describe the campaign with additional parameters.
  6. Confirm by clicking Apply.
  7. Click THEN.
  8. From the dropdown list, select End node.
  9. Click Save & Run.
The view of the Automation
Automation

Check the use case set up on the Synerise Demo workspace


You can check the configuration of:

If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.

Read more


😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker