Event code examples

For conversion tracking and reporting, you must specify one of the nine event types in the event code. This example is tracking the event checkout. You must also replace YOUR_TAG_ID with your Pinterest conversion tag ID from your base code.

<script>
 pintrk('track', 'checkout');
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&noscript=1" />
</noscript>

If you want to track a different event, just replace the instances of checkout with the event type you want to track. Bear in mind that you’ll need to adjust the event type in two places: in the JavaScript code (between <script> and </script> tags) and in the <img> tag.

Other examples of event codes

Bear in mind that you can include any combination of event data per event besides what’s shown in the examples below.

PageVisit
 

<script>
 pintrk('track', 'pagevisit', {
   promo_code: 'WINTER10'
 });
</script>

Signup

<script>
 pintrk('track', 'signup', {
   lead_type: 'New release promotion'
 });
</script> 

 

Checkout
 

<script>
 pintrk('track', 'checkout', {
   value: 116,
   order_quantity: 2,
   currency: 'USD',
   line_items: [
     {
       product_name: 'Pillows (Set of 2)',
       product_id: '11',
       product_price: 48.00,
       product_quantity: 1
     },
     {
       product_name: 'Pillows, Large (Set of 2)',
       product_id: '15',
       product_price: 68.00,
       product_quantity: 1
     },
   ]
 });
</script>

WatchVideo

<script>
 pintrk('track', 'watchVideo', {
   video_title: 'My product video 01'
 });
</script>

Lead

<script>
 pintrk('track', 'lead', {
   lead_type: 'Newsletter'
 });
</script>

Copy and paste event code examples

 

This section contains an example of every event type in a complete, copyable format that you can place on your site directly. Each example has the event data needed to start tracking activity on your website.

You will need to replace example values with the appropriate static value or dynamic variable for your website. For example, you will probably want to track order value dynamically because the value of each order placed on your website will vary depending on what a user buys. However, you might assign a static value to the event data lead_type if it is placed only on one specific page.

Checkout

<script>
 pintrk('track', 'checkout', {
   value: 10.00,
   order_quantity: 2,
   currency: 'USD'
 });
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&ed[value]=10.00&ed[order_quantity]=2&noscript=1" />
</noscript>

Event data: value, order_quantity and currency.

Make sure you input the correct currency code for your website.

AddToCart

<script>
 pintrk('track', 'AddToCart', {
   value: 10.00,
   order_quantity: 1,
   currency: 'USD'
 });
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=AddToCart&ed[value]=10.00&ed[order_quantity]=2&noscript=1" />
</noscript>

Event data: value, order_quantity and currency. Make sure you input the correct currency code for your website.

Pagevisit

<script>
 pintrk('track', 'pagevisit');
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=pagevisit&noscript=1" />
</noscript>

 

Signup

<script>
 pintrk('track', 'signup');
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=signup&noscript=1" />
</noscript>

 

WatchVideo

<script>
 pintrk('track', 'watchvideo', {
   video_title: 'My Product Video 01'
 });
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=watchvideo&ed[video_title]=My+Product+Video+01&noscript=1" />
</noscript>

Event data: Video_title

Lead

<script>
 pintrk('track', 'lead', {
   lead_type: 'Newsletter'
 });
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=lead&ed[lead_type]=Newsletter&noscript=1" />
</noscript>

Event data: lead_type

Search

<script>
 pintrk('track', 'search', {
   search_query: 'horse'
 });
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=search&ed[search_query]=horse&noscript=1" />
</noscript>

Event data: search_query

ViewCategory

<script>
 pintrk('track', 'viewcategory');
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=viewcategory&noscript=1" />
</noscript>

Custom

The event type must be called custom, otherwise the conversions tracked by the tag won't be reported in Ads Manager.

<script>
 pintrk('track', 'custom');
</script>
<noscript>
 <img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=custom&noscript=1" />
</noscript>

 

Still need help?
Contact us