Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
How to trigger Pinterest Add To Cart event only when you click on the add to cart button

I have installed the Pinterest Tag on my ecommerce site on the Product Detail Page. I need the Pinterest tag to trigger the add to cart conversion event ONLY when someone clicks on the add to cart button that is on my page.

The tag is currently tracking the add to cart event as soon as the page loads. So its tracking even when there was no click to the button because its just going based off the page loading. I need it to track only when the button has been clicked.

(Note, I am using the Pinterest Tag Helper Chrome extension. That is how I can visually see that the tag records the ATC event when the page loads and not when I click the button)

What would be the proper jQuery to track this only on click if my code is laid out like this below: Note, the part of the code that reads <img height="1" width="1" is where the trigger is happening for add to cart currently.

<!-- Pinterest Tag -->
<script>
    !function (e) {
        if (!window.pintrk) {
            window.pintrk = function () {
                window.pintrk.queue.push(Array.prototype.slice.call(arguments))
            }; var
                n = window.pintrk; n.queue = [], n.version = "3.0"; var
                    t = document.createElement("script"); t.async = !0, t.src = e; var
                        r = document.getElementsByTagName("script")[0];
            r.parentNode.insertBefore(t, r)
        }
    }("https://s.pinimg.com/ct/core.js");
    pintrk('load', 'MY_PINTEREST_TAG_ID', { em: '<user_email_address>' });
    pintrk('page');
</script>            

<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=MY_PINTEREST_TAG_ID&event=addtocart&ed[value]=@Model.Price&ed[order_quantity]=1&ed[currency]=USD&noscript=1" />

<!-- end Pinterest Tag -->

I have searched on their documentation but it does not show how a real world application would tie into their code to trigger the event on click from a button, it just shows static values. The link below is where I sort of got this code from the section called: Examples of event data in the IMG tag to copy and paste

https://help.pinterest.com/en/business/article/add-event-codes

This is the code for my button:

    <button class="add-item button-primary" 
    data-item-id="@Model.id"
    data-item-price="@Model.Price"                                                                                       
    data-item-name="@Model.Title">
    Add To Cart
    </button>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!