SEO, AdWords, affiliates, advertising, and promotions
Shopify help desk is not able to help me. I want to add an "add to cart" pixel supplied by X and a "purchase" pixel also supplied by X, however - the HTML I'm supposed to be looking for is not where it is supposed to be - I'm terrible at HTML and need assistance
If you’re trying to install an Add to Cart and Purchase pixel from a third-party, here’s how to go about it:
For "Add to Cart": Edit your theme code (Edit code), find the product form (product-form.liquid), and paste the pixel code after the Add to Cart button.
For "Purchase": Go to Settings > Checkout > Order Status Page, scroll to Additional Scripts, and paste your purchase pixel there.
Make sure you add dynamic values (like order total) using Shopify Liquid variables. If you're unsure where exactly to paste itI hope this helps
Moshbray thank you for answering, 'product.form.liquid' is not to be found in my HTML code anywhere in the DAWN theme. Thus I cannot find add to cart. I have had two shopify agents try to help me live and not one could do it. I'm afraid I'm still spinning my wheels. I very much appreciate your effort. Thank you.
Oops, if it's something you really want to make use of i'd suggest you check if there's an app to do it and if not i can try give a look cos i use to write some programming language like Python & JS so a custom button will be created. I hope this would help?
OR Not you try another themes to see if issues persist. Do keep in touch
Hey there,
Let's start with the basics. This is your base code //ensure to change 'Your_Pixel_ID_here':
<script>
!function(e,t,n,s,u,a){
e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),
u.async=!0,u.src='https://static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))
}(window,document,'script');
twq('init','YOUR_PIXEL_ID');
twq('track','PageView');
</script>
[You get this from your X ads account under Tools > Pixel and select Universal Website Tag]
Now, go to Online Store > Themes > Actions > Edit Code > layout/theme.liquid and paste the base code before </head> tag
Now, when that is done, in the same code file, locate sections > main-product.liquid. In that, locate your store's add to cart code snippet that starts with <button type=....</button>
Right below this button, enter this:
<script>
document.querySelector('form[action*="/cart/add"]').addEventListener('submit', function() {
twq('event', 'tw-AddToCart');
});
</script>
This is for add to cart event.
For checkout, the process is slightly different. Go to settings > checkout > order status page > scroll down to find additional scripts and paste this code snippet there:
<script type="text/javascript">
twq('event', 'tw-Purchase', {
value: {{ checkout.subtotal_price | money_without_currency }},
currency: '{{ checkout.currency }}'
});
</script>
Hope this makes sense 😄
Masoomi Saxena | Content Writer @ AdNabu
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- Try our Nabu for Google Shopping Feed App from Shopify App Store.
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