It looks like you're viewing this from a region that Pinterest Tag isn't available in yet. See where Pinterest Tag is available to Pinterest Business accounts. Learn more

The base code is the foundation of the Pinterest tag. You have to add the base code to every page of your website so that event codes can function and audience data can be built from the traffic on your website. Always add the base code to the HTML code of all pages of your website before adding an event code.

If you’ve decided to use manual set-up, you’ll have to add the base code to your website yourself. Refer to the steps below if you’re using the manual set-up option.

  • Log in to your Pinterest business account.
  • Click the hamburger icon at the top-left of the page.
  • Under Business, click Conversions.
  • Click Tag manager at the left-side navigation. 
  • Click Install the Pinterest tag.
  • Click Skip at the bottom-right of your screen.
  • Click Copy code below the gray box.
  • Paste the code between the <head> and </head> tags in your HTML document. If you want to enable optional enhanced match at this point, modify the base code.
  • Click Continue at the bottom-right corner of your screen to move on to enabling automatic enhanced match.
  • Note: Where you place the base code might be different depending on your website.

    It looks like you're reading this from a mobile browser. At the moment, you'll need to use your desktop to add the base code. You can see those instructions by tapping Web above.

    It looks like you're reading this from a mobile browser. At the moment, you'll need to use your desktop to add the base code. You can see those instructions by tapping Web above.

    We do not recommend that you copy and paste this sample base code below. You should always get your personalized base code from your profile in the Conversions page of Ads Manager. The base code will have your unique Pinterest tag ID in place of YOUR_TAG_ID in the code below. 

    <head>
     <!-- Pinterest Pixel Base Code -->
     <script type="text/javascript">
       !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', 'YOUR_TAG_ID');
       pintrk('page');
     </script>
     <noscript>
       <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=init&noscript=1" />
     </noscript>
     <!-- End Pinterest Pixel Base Code -->
    </head>
    Obtain consent to use the Pinterest tag

    You might want to implement code that creates a banner and lets people opt-in or opt-out of using the Pinterest tag. For example, you could place “I consent” and “I do not consent” buttons at the top of the page. This is especially relevant if you operate in the EU, as you're required to obtain legally-compliant user consent before sending any events to Pinterest.

    In order to gather consent for our tag, you must explicitly set the consent of the user, as shown in the example below.

    If consent is set to true (meaning the user consents):

  • Events for the user will be sent to Pinterest to be processed
  • First-party context cookies and storage for the user’s session will be set on the user's browser
  • If consent is set to false (meaning the user does not consent):

  • Events for the user will not be sent to Pinterest to be processed
  • First-party context cookies and storage for the user’s session will be deleted
  • <script>
     pintrk('setconsent', <true/false>});
    </script>
    Delete first-party cookies

    The Pinterest tag creates and accesses cookies in a first-party context on your site domain, providing better visibility into the Pinterest traffic on your site.

    You can delete first-party cookies by setting the fp_cookie parameter in your base code to false, like in the example below. Learn more about cookies and the Pinterest tag.

    <script>
     pintrk('load', '<tag_id>', {
       'fp_cookie': false,
       'em': '<email address>',
     });
    </script>
    What's next?

    Once you’ve added the base code, learn more about automatic enhanced match.

    End of Other articles Links
    Still need help? Contact us
    User feedback
    Was this article helpful?

    collection_fields

    How can we make this article better?