Back to all Usecases
How to Set Up Purchase Confirmation Emails

Introduction

Purchase confirmation emails are among the most common emails sent to customers when they complete a purchase. As marketers, we need to effectively set up purchase confirmation emails—a crucial part of your customer's journey.

In this article, we will understand how to capture purchase data to provide a seamless and user-friendly experience for your customers. We will create an Email campaign to send purchase confirmation alerts to your users.

Expected Result

Whenever a user completes a purchase, the user shall receive a Purchase confirmation email which is completely automated thereby eliminating the need for any manual intervention.

library_add_check

Prerequisites

Events which contain the details of the products purchased by the customer must be captured in an array format, not as individual events.

For example, let us consider the event "Order Placed". As seen in the following screenshot, the customer has purchased four products. The product’s data is captured in the following fields: Variation Title, Product Title, Image URL, Product Price, Vendor name, and so on.

Note the exact spellings of your event attributes' names because it will differ from the following example:

7.png

Create an Email Campaign

In this section, let us set up transactional emails.

Step 1: Target Users

  1. Navigate to the sidebar on the left and click Engage > Campaigns and click + Create campaign or click + Create new > Campaign.
  2. Under Outbound, select Email > Event Triggered.
    13.png
    You are taken to the first step "Target users" of defining your campaign
  3. Enter the following details:
    • Team: Select a team if your organization has teams enabled for your account. For example, select "Demo Account - E-commerce". For more information, refer to Teams in MoEngage.
    • Campaign Name: Enter a name for the campaign. For example, "Purchase Confirmation".
    • Campaign Content Type: Select Transactional.
    • User attribute with email address: Select "Email (Standard)".
      5.png
  4. In the Select condition section, select the event that contains the purchase details as the trigger.
  5. In the Target Audience section, select All users.
  6. Click Next to move to the second step "Content" where you can define the content that will go into your Email campaign.

Step 2: Content

  1. Select the template that you like to go with. For our example, let us select the Blank Template on the Drag and drop editor tab.
  2. Add the following details:
    • Subject
    • Preview Text
    • Sender Name
    • From email address
    • Reply-to email address
  3. In the Template editor section, enter the content of the email message.
  4. Personalize the message by including information such as the user's name. This makes the message more contextual and helps users feel more connected. To do this, enter “@”. The Push Personalization pop-up will be displayed, allowing you to select information from the event or user's properties.
    weather 8.png
  5. Configure the following details:

    Set Up the Template


    After you create the Layout, as seen in the following image, select the row where the product details must be displayed and click Add condition.


    8.png


    Define the Logic


    In the condition block, define the logic of iterating through the arrays and displaying the required details; the logic will ensure to display all products in the array.

    In this logic, assign a variable to each array first and then loop through each array and assign the value in each loop to another variable.

    Sample Code Before

    Code
    {# Assigning a variable to the array #}
    {% set imageURLlist = EventAttribute['Product Image Url'] %}
    {% set titlelist = EventAttribute['Product Title'] %}
    {% set vendorlist = EventAttribute['Product Vendor'] %}
    {% set produrllist = EventAttribute['Product Url'] %}
    {% set pricelist = EventAttribute['Product Price'] %}
    {% set varidlist = EventAttribute['Variant ID'] %}
    {# Looping through the array and assigning a variable to each value in the array #}
    {% for i in titlelist %}
    {% set imageURL = imageURLlist[loop.index-1] %}
    {% set title = titlelist[loop.index-1] %}
    {% set vendor = vendorlist[loop.index-1] %}
    {% set produrl = produrllist[loop.index-1] %}
    {% set price = pricelist[loop.index-1] %}
    {% set varid = varidlist[loop.index-1] %}

    Sample Code After

    Code
    {% endfor %}

    Now the code should look similar to how it is shown the following image:


    9.png


    In the previous code, we are considering six different event attributes; the number of attributes to be displayed is based on the client’s requirement.

    • In the first section of Assigning a variable to the array, assign a new variable to the required event attribute array to use a new attribute.
    • In the section on Looping through the array and assigning a variable to each value in the array, assign a variable to the value from the array utilizing the variables used in the previous section.
    • These variables can then be used to call for the values in the email body.
      10.png

    In this case, we have used the title, vendor, price, and varied attributes.

    info

    Information


    For any numerical arrays, the check for whether the field is iterable must be applied, as done for the price attribute in the previous image. This is because personalisation returns a single value array of numerical as a numerical value, not string.

    In the absence of the previous check, there will be a personalisation error whenever the user buys only one product.

    Configure Images

    1. Click the image content block.
    2. Turn the Dynamic image toggle on.
    3. In the Dynamic Url field, enter the JINJA attribute.
      11.png

    Configure the Redirection URL

    1. Select the text.
    2. Click the Link option from the text formatting options box that pops up.
    3. Enter the JINJA attribute.
      12.png
    warning

    Warning


    While you send the data to MoEngage, ensure that the index in arrays for each product is maintained. That means, the details of Product 1 must be passed at Index 0 in all arrays, the details of for Product 2 must be passed at Index 1 in all arrays.

    In case of any mismatch, the products may have wrong information mapped.

     

  6. Click Next to move to the third step "Schedule and goals" where you can define the schedule and goal of your campaign.

Step 3: Schedule and Goals

  1. Define when to start and end this campaign and the conversion goal based on your requirements.
  2. Change the deliverability settings based on your requirements. For more information, refer to Create Email Campaigns.
  3. Click Publish.

Conclusion

In this use case, we understood how to capture purchase data to provide a seamless and user-friendly experience for your customers. We created an Email campaign to send purchase confirmation alerts to your users.

After the campaign is live, you can track its performance from the campaign analytics and info page.

Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?