Base code

The base code is the primary code for Pinterest tag. It needs to be added to every page of your website in order for any event code to function and to build audience data from all the traffic on your site. 

You can generate your individual base code in the Conversions page in Ads Manager, which contains your unique tag ID. You only need to generate one unique tag ID. Once generated, place your base code on every page of your website to track conversions and build audiences across your entire website.


It’s important to place the base code so that it loads first on the page. Typically, this is in the <head> section of your website’s HTML, but it may be different depending on your website. The base code needs to fire before the event code, so be sure to place it so that it will fire before any event code you plan to implement.


Below is an example base code, but remember that you should retrieve your personalized base code from your profile in Ads Manager or the API. It is not recommended to copy and paste from this guide. When you obtain your base code from Ads Manager it will have your unique Pinterest tag ID inserted in the proper locations of the code, where you see YOUR_TAG_ID in the code below.

 <!-- Pinterest Pixel Base Code -->
 <script type="text/javascript">
   pintrk('load', 'YOUR_TAG_ID');
   <img height="1" width="1" style="display:none;" alt="" src="" />
 <!-- End Pinterest Pixel Base Code -->

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.

Note that you always have the option to delete first-party cookies by updating your base code to set the fp_cookie parameter to false:

 pintrk('load', '<tag_id>', {
   'fp_cookie': false,
   'em': '<email address>',

Next steps

Once you’re done adding the base code you can add an event code.

Still need help?
Contact us