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.
If you’ve decided to use manual setup, you’ll have to add the base code to your website yourself. Refer to the steps below if you’re using the manual setup option.
Note: Where you place the base code might be different depending on your website.
It looks as though you're reading this in 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 as though you're reading this in 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 the sample base code below. You should always
<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>
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):
If consent is set to false (meaning the user does not consent):
<script>
pintrk('setconsent', <true/false>});
</script>
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. Find out
<script>
pintrk('load', '<tag_id>', {
'fp_cookie': false,
'em': '<email address>',
});
</script>
Once you’ve added the base code, find out