Liquid, JavaScript, themes, sales channels
Hi all!
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) :
https://help.pinterest.com/en/business/article/shopify-and-pinterest-tag
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.
Hey @j_stan,
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"...
Would become:
<button onclick="pintrk('track', 'addtocart');" type="submit" name="add"...
Scott | Developer Advocate @ Shopify
This is an accepted solution.
Hey @j_stan,
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"...
Would become:
<button onclick="pintrk('track', 'addtocart');" type="submit" name="add"...
Scott | Developer Advocate @ Shopify
Hi. Same question, but for PageFly theme, please. Thank you.
@AlexKptv, please reach out to PageFly support.
Scott | Developer Advocate @ Shopify
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!
Regards Max
Hi all,
same goes for me, I don't understand how to add the code for the "AddtoCart". I have the minimal theme - can someone help please?
Thanks,
David
Same issue with minimal theme
Same issue with Prestige theme tracking checkouts.
I get an overall health of my Pinterest tag of unhealthy because there is no checkout event firing. Where do I put the code to track checkouts/conversions in Prestige? I was instructed to find the addtocart function in product.liquid but it's not there.
For the checkout you should add it to the Setting -> Checkout and add the checkout code in the additional scripts section. For the add to cart you have to go to Online Store -> Themes -> Edit Code and search product-form.liquid on the Snippets section.
Then you ctrl+F and search:
<button type="submit" class="ProductForm__AddToCart Button
Once you have it you should add onclick="pintrk('track', 'addtocart');" to the code so it will look like:
<button onclick="pintrk('track', 'addtocart');" type="submit" class="ProductForm__AddToCart Button...
I am really struggling to find the add to cart button for my theme. I've checked and searched product-template.liquid, product-form.liquid but nothing...
Any idea where it would be?
Wokrs like charm, thx !
I'm using the narrative theme as well, did you manage to solve it?
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 would appreciate help for Cascade theme. I also cannot find the addtocart. In product.liquid template there is an indication to look for section product.liquid, but there is nothing really. Would be good for Shopify to provide more support on integrating with Pinterest!
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.
Hi there, I am using a streamline theme. I met the same problem of Pinterest add to cart event code. Can you help plz?
Thanks a lot.
Hi. Same question, but for Kalles theme, please. Thank you.
Hi! I just want to ask if this solution is also applicable to the craft theme? I’m having the same issues as well with the Pinterest addtocart event. I can’t seem to find where to put the code.
for Dawn theme please..
. I am trying to add Pinterest addToCart event code manually, but I cannot find the addtoCart section on the theme.liquid or main-product.liquid file and i have tried searching for the custom.js file too but didn't find that as well. I have tried reaching out for help on shopify community.
I am using the Studio theme
Hi, did you manage to install the addToCard event code already ? I'm also using the Studio theme, can't find it;
I couldn't find a way to manually add the addToCart event code, so I changed my store location and installed the Pinterest app from the Shopify store. After that, I reverted the location back to its original setting, and everything worked smoothly, including the tags.
Hi Harsh300969, thank you for your reply! What exactly do you mean with 'I changed my store location' and then you reverted the location back?
how do you change the store location, I'm thinking of doing that as well!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024