Abandoned Cart Snippet Google Tag Manager

  • 9 May 2023
  • 3 replies



Does anyone have a code snippet to check for an Abandoned Cart that I can install through Google Tag Manager?


Thank you!


Best answer by David To 11 May 2023, 00:29

View original

3 replies

Userlevel 7
Badge +59

Hello @bjones,

Welcome to the Klaviyo Community!

When you mean “abandoned cart code” are you talking about the add to cart code used for Shopify and BigCommerce?

If so, then I would suggest using the installation method provided in either our How to create an "Added to Cart" event for Shopify or How to create an "Added to Cart" event for BigCommerce Help Center articles depending on your ecommerce backend. 

Because you will need to both formulate and place the code in the correct spot, Google Tag Manager may not be the most effective installation method. 

I hope this helps!



Hi @David To ,

Thanks for the response.
I am looking to add a tag to Google Tag Manager that will indentify an abandoned cart and pass that information to Klaviyo.
I am using a custom site ( that doesn’t support a direct integration with Klaviyo, hence why I am going through Google Tag Manager. The data layer on this site already has “add to cart”, “remove from cart”, “purchase” etc events, so they events are there. I just need a way to get Klaviyo to recognise the abandoned cart.

Any ideas?

Userlevel 7
Badge +59

Hey @bjones,

In that case, I would suggest taking a look through our Integrate an ecommerce platform without a pre-built Klaviyo integration Developer guide. In it, you’ll find resources and guidance on how to connect a custom ecommerce platform to Klaviyo when there isn’t a native integration available.

This method would be more effective since many of those ecommerce events you’ll want to record and trigger are done in the backend on server side such as purchased/placed order events. 

However, I would imagine you would most likely be able to use Google Tag Manager to help install the codes that are fired on the front-end via javascript. 

If you need more hands on assistance, I would further recommend reaching out to one of our many skilled developers through our Klaviyo Partner Directory.