Question guys. I have an add to cart button and o...
# questions
h
Question guys. I have an add to cart button and onClick I want the add to cart button to fire an event. This is my code
{% if template.name == 'product' %}
let addToCart = document.getElementById('add-to-cart');
addToCart.addEventListener('click', function(){
mixpanel.track('Add to cart button clicked')
})
{% endif %}
But I keep getting this error. What could be the issue?