Personalized checkout and custom promotions with Shopify Scripts
Hi Shopify community I have couple of questions about manually setup the pixel code of Meta to track different actions on the platform, I use Conversions Gateway connected to my events Manager by stape.
So firstly I want to track the Add to cart button which is located on the product pages, where is the description and etc, after people view the product. So I found out there is a possibility to track button if you find exact code, id, or any parameter you can find your button in code. So I used inspect tool found it on my website:
And then I also have found it in the product page code:
So the first question - I do not understand where exactly the code should be placed for it to trigger right way I have this code for that: *and secondly I need to put the basic pixel code above all this? or I can somehow reference this to the pixel code I have in theme.liquid file?
<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>
Or I found also this basic code, or it won't work if I will put it right in the product theme in button code?
onclick=fbq('track', 'AddToCart', { content_category: 'Apparel & Accessories > Shoes', content_ids: ['1234'], content_type: 'product',
2. The same question is about the Intiate checkout button it's on the side sliding add to cart, and would I need to do same with that button?
And 3. question at the moment I have 2 add to carts one sliding from side, and second is on collections page where you can add to cart without viewing product - and I want to remove second option add to cart, when they can add it without looking into product view, how it could be done?
For reference I will add up : My store - if it helps to give the answer.
Thanks and have a great day!
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025