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
}