Skip to main content
Solved

How to Create a Custom "Added to Cart" & "Viewed Product" Event for Magneto2

  • January 19, 2021
  • 4 replies
  • 1585 views

Forum|alt.badge.img+7

Hi,

Does anyone have the snippet of code that is need for the added to cart & viewed product event for Magneto. I can find shopify and Bigcommerce.

 

Many thanks

Dave

Best answer by Paul S

Hi @davemanson 

 

So the reason you’re able to find documentation for Shopify and BigCommerce Added to Cart and Viewed Product but not Magento is that we do not have a built-in or copy-paste Added to Cart snippet for Magento.

 

Even though we don’t have something that can be copied and pasted like for Shopify or BigCommerce, you can still get this set up but this is something that the business will need to set up using our Javascript Track API.

The process (and most likely the snippet you’re looking for) is similar to the process for Shopify and BigCommerce meaning listening for a person clicking on the “add to cart” button and then sending the Viewed Product payload as an Added to Cart event.

 

I would definitely recommend passing this information along to whatever developer resources you have available so that they can take a look and get this set up. 

View original
Did this topic or the replies in the thread help you find an answer to your question?

4 replies

Forum|alt.badge.img+10
  • Klaviyo Employee
  • 101 replies
  • Answer
  • January 20, 2021

Hi @davemanson 

 

So the reason you’re able to find documentation for Shopify and BigCommerce Added to Cart and Viewed Product but not Magento is that we do not have a built-in or copy-paste Added to Cart snippet for Magento.

 

Even though we don’t have something that can be copied and pasted like for Shopify or BigCommerce, you can still get this set up but this is something that the business will need to set up using our Javascript Track API.

The process (and most likely the snippet you’re looking for) is similar to the process for Shopify and BigCommerce meaning listening for a person clicking on the “add to cart” button and then sending the Viewed Product payload as an Added to Cart event.

 

I would definitely recommend passing this information along to whatever developer resources you have available so that they can take a look and get this set up. 


Forum|alt.badge.img+7
  • Author
  • Active Contributor I
  • 11 replies
  • January 20, 2021

Brilliant thank you


Omar
Partner - Platinum
Forum|alt.badge.img+46
  • 2025 Champion
  • 494 replies
  • January 21, 2021

@davemanson additionally if you have GTM with Google Analytics setup you could leverage the same data to send an event to Klaviyo (using GTM).

If not it's basically triggering a script when someones clicks on the add to cart button that sends related information (product info) to Klaviyo using what @Paul S mentioned.


Forum|alt.badge.img+1
  • Contributor I
  • 1 reply
  • January 27, 2021
davemanson wrote:

Brilliant thank you

How did you achieved that? i also want to do something similar like that.