Forum Discussion

Manoj__'s avatar
Manoj__
Specialist
12 months ago

How to loop products from added_item_to_cart events in an email?

Hello Experts,

I am building my first canvas journey in Braze for an Abandoned cart use case. I am using an email channel as a message in this use case.

In my scenario, I have added 2 products to the cart and I want to print those two products by email.

The issue I am facing is how to print these products via event using a for loop.

I have tried Advanced Event Properties. But It just prints item_name. How do we know which item it is from the event? There could be 2 or more products in the event

The learning section here only shows the push notification which is easy to configure.

 

 

  • Manoj__ , I'd be interested if you made progress with this - I was scrolling back through posts after not being around for a while.

    Do you know what the structure of your added_item_to_cart event is? So far as I know there's no standard definition of which attributes should be populated, so the answer to this is going to be dependant on what your data looks like.

    • Manoj__'s avatar
      Manoj__
      Specialist

      Hello bob No luck on this one yet. I can't figure out where to start.

      I am using the Braze Pilot app to test the platform. My assumption is Abandoned cart is based on on added_item_to_cart event. 

      The normal behaviour of a customer is to add products to a cart one by one. And the same way Braze will share this data with Events.
      Now if I want to send an Abandoned cart email, How Do I merge these 2 or more event data in a single email?

      A workaround could be to wait for some time to create an array on the app and then add this array as a single added_item_to_cart event.

  • Hey Manoj__ - just a few questions here:

    1.  Is the abandoned cart event a custom event in which you are getting the full readout of the products in the cart? 

    2.  Are you sending unique events for each time an item is added to the cart?  This would be problematic as you would not be able to "store" the data from multiple events easily to then be used within an email.

    3.  My advice here would be to get the "added_item_to_cart" event to concat and show the full products list added to the cart.  I.e. first event shows apples, second event shows apples, bananas (when bananas was just recently added) and so on.  This would require some changes obviously on the backend / data side.

    From there you can just run a for loop in liquid based on the latest event and print them out in the email as needed.   Goes without saying that the trigger for the campaign would be the triggering of the add item event with a delay to give time for additional add item events.  Let me know and Ill see if I can help.

  • Hey Manoj__ If you are still looking for solution, I have a work around for this...

    you can have another custom attribute (List_of_cart_items) which would be updated in realtime/batch. Now set your canvas entry as action based and action would be "change custom attribute value", as soon as List_of_cart_items values changed message will be triggered.

    for personalization, you just need to run a loop for Array attribute List_of_cart_items and print values based on cart_items using connected content. 

    hope it helps.

     

    • Manoj__'s avatar
      Manoj__
      Specialist

      Hello Ishwar_Patidar  Using customer attribute is good option but I don't want to use this as this will increase the data points consumption.

  • Hey Manoj__ , 

    Youtube Tutorial on this topic, coming this week. This is a very very common use case. Stay tuned! 

    Allan

  • Hey Manoj__ , as promised, here you go! https://youtu.be/mMqrHqeYHto

    I will say: having a Custom Attribute called items_in_cart makes this much, much easier. It's really the only way to do it, to account for new items added, items deleted, etc. 

    Hope this helps, and please feel free to reach out with questions! 

    • Manoj__'s avatar
      Manoj__
      Specialist

      Hello AllanHeo 

      Thanks for sharing the video.

      Unfortunately, I don't want to go down this path as I will have duplicate data in customer attributes and in the events.

      Also, updating customer attributes multiple time will increase the data point usage which will impact the billing.  A retails business can have thousands of customer abandoning the cart and customer attribute will increase the data points consumption rate for us.

      • AllanHeo's avatar
        AllanHeo
        Strategist

        Hi Manoj__ , 

        Unfortunately, I don't want to go down this path as I will have duplicate data in customer attributes and in the events.

        I don't see a huge issue with having duplicate data in custom attributes and in the events. To clarify, the cart items data that lives in your Custom Event Properties do not count towards your Braze Data Points Billing (unless you have property segmentation enabled).

        Also, there are certainly situations where even if you have the data available as a fleeting Custom Event Property, you need it as a more permanent Custom Attribute, exactly in Cart Abandon situations like this.

        Also, updating customer attributes multiple time will increase the data point usage which will impact the billing.  A retails business can have thousands of customer abandoning the cart and customer attribute will increase the data points consumption rate for us.

        I certainly agree with this concern; this use case may require a little bit of research and calculation. If you have a CDP or any other tool that gives you an understanding of how many times "cart add" or "cart delete" gets performed by your users on a daily basis, this would be a great starting point. 

        I will note that Braze Data Points are based on a per-user-basis, with the contracts typically starting at ~250 data points per user per month. I would argue that a crucial campaign like Cart Abandon deserves at least a handful of data points per user per month for the proper execution. Of course, once again, it comes down to a bit of calculation and ROI. 

        One workaround could be to update the Custom Attribute once per day; this way, you're not incrementing data points for every user action. Of course, this brings the risk of the Cart Abandon email not having the most updated items. Something to consider. 

        Please let me know if I can answer any other questions!