Track "Add to cart" action on Webflow eCommerce

This code snippet tracks all "Add to Cart" events on your eCommerce site made on Webflow.


// get all add to carts on the page and add some magic
const forms = document.querySelectorAll('[data-node-type="commerce-add-to-cart-form"]')
forms.forEach(function(form){
	form.setAttribute('onsubmit', 'callEvents()');   
}) 

function callEvents(){
// add your functions to be called here
// add common examples
}
Copy Code

We do Webflow development for clients around the world.

We cater to your Webflow and engineering requirements for your marketing.
 
We are your dedicated and plug-and-play developers for your marketing and WebOps efforts.