Hello,
I know this question has been raised a lot of times, but I can’t figure it out. The add to cart trigger (Metric) is not working.
I’ve posted all the Code in the product-template.liquid (Sections) because Wokiee theme does not have a product.liquid.
I’ve also tried both variants (class and ID) - still no metrics.
I already see viewed product event associated with Mail (cookied)
Would be great if somebody could help me on that.
Thank you very much
ID
<script type="text/javascript">
var _learnq = _learnq || r];
document.getElementById("teeAtcButton").addEventListener('click',function (){
_learnq.push(p'track', 'Added to Cart', item]);
});</script>
CLASS
<script type="text/javascript">
var _learnq = _learnq || l];
var classname = document.getElementsByClassName("tee-btn tee-btn--atc");
var addToCart = function() {
_learnq.push({'track', 'Added to Cart', item]);
}; for (var i = 0; i < classname.length; i++) {
classname+i].addEventListener('click', addToCart, false);
}
</script>