Trigger Add to Cart and Cart Abandon for Custom SAAS solution

Badge +2



Ive been doing some digging. If i have a custom software with products and i want to trigger add to cart and browse abandon flows.


Will I need to:

1. Initialize klaviyo on the client? Then do something like the following to ensure they flow is triggered?


2.Does anything need to be done on the server with the api? Or is this all done client side? Thanks


Best answer by Brian Turcotte 26 May 2023, 19:46

View original

2 replies

Userlevel 7
Badge +36

Hi @Sstern6!


All flows in Klaviyo begin with a trigger, and the Browse Abandonment and Added to Cart flows are triggered by the Viewed Product and Added to Cart metrics, respectively. Therefore, in order to create flows in Klaviyo, you need to have these metrics present in your Klaviyo account. 

Since you’re describing a custom integration, this will take a few extra steps. First, I would recommend reading through this entire guide:

This guide will help clarify the optimal structure of a custom integration.

Per your specific questions: 

  1. The prerequisites for adding any of the custom tracking snippets (Viewed Product, Added to Cart, Started Checkout, etc.), are to:
    1. Add the Active on Site tracking Snippet, which identifies cookied site visitors, so that you know who is triggering metrics on your site.
    2. Initialize the klaviyo object, which is accomplished by manually installing a JavaScript snippet on your web pages: 

Once those steps are accomplished, you can move on to adding the metrics via the snippets referenced in the above guide:

  1. Some events are created with the JavaScript (client-side) API, and some in the server-side. The Viewed Product and Added to Cart events are tracked on the server-side, using the snippets mentioned above. For a more expansive list of where (client-side vs. server-side) each event is created, see this section in our Developer Portal:

Once you have accomplished all of the above steps, then you can go and create the flows within the Klaviyo UI, using the metrics as triggers.

If you feel you could use some more development guidance, you’re always welcome to reach out to one of our wonderful Official Klaviyo Partners for more help!


I hope this helps, and thanks for using the Community!

- Brian

Thanks Brian.  Can a business on any Klaviyo plan use the above mentioned features?