I'm trying to set up Pinterest conversion tracking codes, so I just pasted a Pinterest base tag & Checkout Event to the theme.liquid file & checkout settings, however, I also want to add the Add To Cart event code, but I was not able to do it with the help of the official instructions since I couldn't find a line of code where I needed to pass the Add to Cart code. Can you tell me exactly where I should paste the code?
Instructions that I was looking at were these (Step 3) :
In my current code that I have in my product.liquid I couldn't find addtocart section where I need to input the Pinterest code. I talked to a support agent on chat and he pointed me out here. FYI Im using the Brooklyn theme.
If there is more info you need let me know. Any help would be highly appreciated. Thanks!
Solved! Go to the solution
This is an accepted solution.
Adapting their instructions to the Brooklyn theme, you can add the `onclick` attribute to the submit button (around line 311 of sections/product-template.liquid on a fresh theme).
<button type="submit" name="add"...
<button onclick="pintrk('track', 'addtocart');" type="submit" name="add"...
Hey I have the same issue - I followed all steps on here: https://help.pinterest.com/en/business/article/manually-add-shopify-tag except the last one with the Addtocart Button. I am using the Narrative Theme and I cannot find the button anywhere. Please help me solve this!
Hi. Would be grateful to know how to add the pinterest tracking code in the product.liquid file;
In my theme the addtocart code looks like this;
var $addToCartForm = $('form[action="/cart/add"]');
The Pinterest code to add is onclick="pintrk('track', 'addtocart');"
I didn't want to break it but unsure how to add it correctly. Thanks
I've been working with Pinterest support and have not been able to get my add to cart code correct. I'm using the Shopify Theme Debut and placing the code on line 211 as their instructions: data-add-to-cart onclick="pintrk('track', 'addtocart');" >
The add to cart fires; however, it gives off 2 errors.
# 2 is an issue and will not allow me to proceed to be verified on the Pinterest platform.