My shopify theme is Ella. The ID for my Add to cart button as below
<input data-btn-addtocart="" type="submit" name="add" class="btn" id="product-add-to-cart" value="Add to Cart" data-form-id="#add-to-cart-form">
The snippet i put on my product.liquid as below; but the metrics haven’t showed the Added to cart. Can anyone pls tell me what is wrong? Thank you.
<script type="text/javascript">
var _learnq = _learnq || [];
document.getElementById("product-add-to-cart").addEventListener('click',function (){
_learnq.push(['track', 'Added to Cart', item]);
});
</script>
Best answer by stephen.trumble
View original