Question

Note: Before marking it as duplicate please read description carefully

I am creating a module for Facebook pixel tracking and I am stuck at AddToCart event.

I have seen some 3rd party extensions, but the issue is they are tracking AddToCart after page load and my AddToCart event should based on ajax based.

So my question is, how can I trigger AddToCart facebook pixel code after ajax add to cart?

Was it helpful?

Solution

If you know the ID/Class of the add to cart button why not just create a custom on page javascript something like

$('.addtocart.btn').on('click', function() { // Do the Magic });

you may need to adjust the class. i will create a extension for FB pixel very soon to include the ajax add to cart option. so fixes an issue a lot of people will be having

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top