Facebook-for-woocommerce: Support for add to cart pixel on ajax add to cart

Created on 27 Jul 2017  路  5Comments  路  Source: facebookincubator/facebook-for-woocommerce

The pixel doesn't seem to fire after an item has been added to the cart asynchronously from the archive pages.

feature-request help wanted up-for-grabs

All 5 comments

We definitely don't fire the pixel on AJAX add to cart. We could support this in the future based on demand for this feature, it would be a big change for us though.

I ended up writing it into my own plugin. I don't have time for a PR right now, but I could probably paste some snippets of you wanted.

Definitely interested in how you solved this! Would love to see some snippets.

Pulling very heavily from your plugin, I added some code into the "base pixel" that fires a second little ajax request when the ajax add to cart JS trigger fires
https://github.com/AltoLabs/snappic-woocommerce/blob/master/includes/class-snappic-pixel.php#L34-L47

That builds the new pixel event and sends it back to the script to be injected in the <head>
https://github.com/AltoLabs/snappic-woocommerce/blob/master/includes/class-snappic-pixel-display.php#L98-L109

Hope that helps!

Thanks for that! I would definitely like to set aside some time to merge this into our repo but we're dealing with a large number of bugs right now. If you ever have time to send that PR we could review it pretty quickly though! Please consider it.

Was this page helpful?
0 / 5 - 0 ratings