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

The base code is the foundation of the Pinterest Tag. You need 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.

Add the base code to your website
  • Log in to your Pinterest business account
  • Click Ads at the top of your screen, then click Conversions
  • Choose how you want to install the Pinterest Tag:
    • Click Get started next to Use an integration partner to select which integration partner you want to use, then follow the steps provided
    • Click Add code next to Add code to website to install the tag yourself
    • Click Email address next to Email instructions to send instructions to your technical support so they can install the tag for you
  • After you click Add code, scroll down in the box that appears and click Copy code
  • Paste the base code you copied in the global header of your website’s HTML, between the <head> and </head> tags so that it’s present on every page
  • Note: Where you place the base code might be different depending on your website.

    We do not recommend that you copy and paste this sample base code below. You should always get your personalised 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>
    Customise your base code
    Delete first-party cookies

    The Pinterest Tag creates and accesses cookies in a first-party context on your site domain, providing better visibility of 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. Find out more about cookies and the Pinterest Tag.

    <script>
     pintrk('load', '<tag_id>', {
       'fp_cookie': false,
       'em': '<email address>',
     });
    </script>
    Metadata enrichment

    If you’re using catalogues and shopping ads to showcase your products, Pinterest will use the tag to update your product information automatically to match the information on your website. This is referred to as metadata enrichment. 

    If you want to opt out of metadata enrichment, update your base code to include {‘md_frequency’: 0}, like the example below. Bear in mind that opting out of metadata enrichment might reduce the distribution of your product Pins on Pinterest.

    
       window.pintrk('load', 'YOUR_TAG_ID', {'md_frequency': 0})
      
    What's the next step?

    Add event codes so you can track specific events when they happen on your website. 

    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?