Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
does anyone know why the facebook pixel event add to cart is not triggered?
Hello Winda_Lis,
In addition to tracking your website visitors, Facebook pixel lets you track nine different “Standard Events” that people make on your website.
If you want to track any of these Standard Events, as you stated “Add-to-cart” you’ll need to add some additional code to your website’s header section, just above the </head> tag.
Your website’s original code: Paste the Facebook pixel code between the <head> and </head> tags of your web page.
Your Facebook pixel base code: what you installed in the previous step of this guide
Your standard event code: Within your Facebook pixel code, above the </script> tag, paste the Standard Event code. You’ll need to add the Standard Event’s code to every page you want to track.
AddToCart either on a new page load or on the click of an Add To Cart button. There are multiple ways to handle clicks on buttons.
Here’s how the code will look:
<!-- Somewhere there is a button that performs Add to Cart --> <button id="addToCartButton">Add To Cart</button> <!-- Add Pixel Events to the button's click handler --> <script type="text/javascript"> var button = document.getElementById('addToCartButton'); button.addEventListener( 'click', function() { fbq('track', 'AddToCart', { content_name: 'Really Fast Running Shoes', content_category: 'Apparel & Accessories > Shoes', content_ids: ['1234'], content_type: 'product', value: 4.99, currency: 'USD' }); }, false ); </script>
So please check if the code has been installed at standard event way on your website.
User | RANK |
---|---|
7 | |
4 | |
4 | |
3 | |
3 |