Event codes let you measure the impact your Pinterest ads have on certain onsite actions. They’re necessary to launch campaigns that will automatically optimize specific events such as conversion campaigns or dynamic retargeting ads. You’ll also need event codes to
After you
The table below shows the events that you can track with the Pinterest tag. You can use them to
Event | Purpose |
---|---|
Checkout | Track people who complete transactions. |
Addtocart | Track people who add items to shopping carts. |
Pagevisit | Track people who view primary pages, such as product pages and article pages. |
Signup | Track people who sign up for your product or service. |
Watchvideo | Track people who watch videos. |
Lead | Track people who show an interest in your product or service. |
Search | Track people who search on your website for specific products or shop locations. |
Viewcategory | Track people who view category pages. |
Custom | Track a custom event. Use this event name to track a special event that you want to include in your conversion reporting. |
[User-defined event] | Add any additional events that you’ve defined for the purpose of audience targeting. Unique events are not available for conversion reporting. Keep in mind that any spaces in the custom event names passed through the tag will be removed. |
There are required and recommended events depending on what ads campaign you decide to run.
Campaign type | Required events | Recommended events | Required event data | Recommended event data |
---|---|---|---|---|
Brand awareness | None |
|
None | Enhanced match |
Catalog sales |
|
|
|
|
Consideration | None |
|
None | Enhanced match |
Conversions |
At least one of the following: |
|
None |
|
Video views | None | None | None | Enhanced match |
There are required and recommended events depending on what features you want to use.
Feature | Required events | Recommended events | Required event data | Recommended event data |
---|---|---|---|---|
Conversion insights |
|
None | Currency | None |
Verified Merchant Program (VMP) |
|
None | Currency | None |
Dynamic retargeting |
|
None |
|
None |
If you’ve decided to use manual set-up, you’ll have to add event codes to your website yourself. The steps below are for people who are using the manual set-up option.
Note: If an event is triggered only after someone takes a specific action on the page such as clicking a button or submitting a form, make sure that the event code only runs as a result of that action. This requires an understanding of the existing event handlers in your page’s JavaScript code.
You can provide additional information about an event by attaching an object that contains event data. All event data is available for audience targeting but only value and order_quantity event data are available for paid and organic conversion reporting.
Event data | Sample value | Type |
---|---|---|
value | 100.00 | Number (integer or floating point) |
event_id | eventId0001 |
String (an id string that uniquely identifies the event) Note: This id can be sent under any of the following field names, all case-sensitive: |
order_quantity | 1 | Integer |
order_id | 1234OrderID | String (order_id is required for conversion analysis reporting) |
product_name | Parker Boots | line_items array, string |
product_id | 1414 | line_items array, string |
product_category | Shoes | line_items array, string |
product_variant_id | 1414-Red | line_items array, string |
product_variant | Red | line_items array, string |
product_price | 99.99 | Number (integer or floating point), line_items array, string |
product_quantity | 1 | Integer, line_items array, string |
product_brand | Parker | line_items array, string |
promo_code | WINTER10 | String |
property | Athleta | String |
search_query | boots | String |
video_title | How to style your Parker Boots | String |
lead_type | Newsletter | String |
currency | USD |
One of the following: AED, AMD, ARS, AUD, AZN, BAM, BGN, BHD, BMD, BND, BOB, BRL, BSD, CAD, CHF, CLP, CNY, COP, CRC, CZK, DKK, DOP, EGP, EUR, FJD, GBP, GEL, GIP, HKD, HNL, HRK, HUF, IDR, ILS, INR, ISK, JMD, JPY, KGS, KRW, KWD, KZT, MAD, MDL, MOP, MXN, MYR, NOK, NZD, OMR, PAB, PEN, PHP, PKR, PLN, QAR, RON, RSD, RUB, SAR, SEK, SGD, THB, TRY, TWD, UAH, USD, UYU, VND or ZAR. Note: When you provide a currency with your tag event, we’ll calculate the exchange rate to match your advertiser account currency. |
The IMG tag is a piece of code within the Pinterest tag that acts as a backup in case people have disabled JavaScript in their browsers. We recommend that you include event data in the IMG tag too as this enables better user targeting. You can choose to only use the IMG tag without the JavaScript tag but you’ll have to
Below are examples of every event type so you can copy and paste them directly on your website. Note that you'll have to replace example values with a
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&ed[event_id]=YOUR_EVENT_ID&ed[value]=10.00&ed[order_quantity]=2&noscript=1" />
Event data: event_id, value, order_quantity, and currency
Make sure you enter the correct currency code for your website.
<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" />
Event data: value, order_quantity, and currency.
Make sure you enter the correct
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=pagevisit&noscript=1" />
Event data: none
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=signup&noscript=1" />
Event data: none
<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" />
Event data: video_title
<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" />
Event data: lead_type
<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" />
Event data: search_query
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=viewcategory&noscript=1" />
Event data: none
The event type must be called custom—otherwise, the conversions tracked by the tag won't be reported in Ads Manager.
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=custom&noscript=1" />
Event data: none
Value and order_quantity are the two pieces of event data available in paid and organic conversion reporting. If you want to add value and quantity, you can pass them back dynamically. A dynamic value can change depending on the action taken on your site. If you choose to pass back value and order_quantity, this will be unique to your website and how you record sales. The value and quantity of products in each order placed on your website usually varies.
<script>
pintrk('track', 'checkout', {
value: {{Enhanced Transaction Revenue}},
order_quantity: {{item.quantity}}
});
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&event=checkout&ed[value]={{Enhanced Transaction Revenue}}&ed[order_quantity]={{item.quantity}}&noscript=1" />
</noscript>
Reported value: Dynamic amount purchased with the corresponding checkout
Reported quantity: Dynamic quantity purchased with the corresponding checkout
Note: The setup of dynamic order quantity and value is unique to your website.
In addition to event data, you can pass a JavaScript callback function as an optional argument to the function pintrk(). This provides additional information if something has gone wrong with your tag which you can check in your developer tool. This callback function runs every time an event tracking call, the function pintrk(), is triggered.
The callback function takes the following two arguments:
function(didInit, error) {}
didInit: This first argument receives a boolean value, which is set to be true if the event tracking call is successfully constructed and false if an error is detected while making the event tracking call.
error: This second argument receives a string, which describes the error when didInit returns false; if didInit is true, this string is undefined.
<script>
pintrk('track', 'checkout', {
value: 10.00,
order_quantity: 2,
currency: 'USD',
event_id: 'eventId0001',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_price: 5.00,
product_quantity: 1
},
{
product_name: 'Parker Sandals'
product_id: 'ABC',
product_price: 5.00,
product_quantity: 1
}
]
}, function(didInit, error) { if (!didInit) { console.log(error); }
});
</script>
For conversion tracking and reporting, you must specify one of the nine event types in the event code. You must also replace YOUR_TAG_ID with your Pinterest conversion tag ID. Remember that you can include any combination of event data per event besides what’s shown in the examples below.
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. Note that you have to replace example values with the appropriate static value or dynamic variable for your website. For example, you'll probably want to track order value dynamically because the value of each order placed on your website will vary depending on what someone buys. However, you might assign a static value to the event data lead_type if it is only placed on one specific page.
<script>
pintrk('track', 'checkout', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Event data: value, order_quantity, currency, and event_id.
Make sure to enter the correct currency code for your website.
<script>
pintrk('track', 'addtocart', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Event data: value, order_quantity, and currency.
Make sure to enter the correct currency code for your website.
<script>
pintrk('track', 'pagevisit', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
<script>
pintrk('track', 'signup', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
<script>
pintrk('track', 'watchvideo', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Event data:Video_title
<script>
pintrk('track', 'lead', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Event data: lead_type
<script>
pintrk('track', 'search', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Event data: search_query
<script>
pintrk('track', 'viewcategory', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
<script>
pintrk('track', 'user_defined_event_name', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
The event type must be called custom, otherwise the conversions tracked by the tag will not be reported in Ads Manager.
<script>
pintrk('track', 'custom', {
event_id: 'eventId0001',
value: 100,
order_quantity: 1,
currency: 'USD',
order_id: 'X-15148',
promo_code: 'WINTER10',
property: 'Athleta',
search_query: 'boots',
video_title: 'How to style your Parker Boots',
lead_type: 'Newsletter',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_variant_id: '1414-Red',
product_variant: 'Red',
product_price: 99.99,
product_quantity: 1,
product_brand: 'Parker'
}
]
});
</script>
Here are some examples of base codes combined with event codes. Remember to confirm the event code is placed after the base code on your website.
Example conversion tag ID: 123456789 (replace with your Pinterest conversion tag ID)
Example event code: Pagevisit
<head>
<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', '123456789'); pintrk('page');
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&noscript=1" />
</noscript>
<script>
pintrk('track', 'pagevisit');
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&event=pagevisit&noscript=1" />
</noscript>
</head>
Example conversion tag ID: 123456789 (replace with your Pinterest conversion tag ID)
Example event codes: Pagevisit and addtocart
<head>
<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', '123456789'); pintrk('page');
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&noscript=1" />
</noscript>
<script>
pintrk('track', 'pagevisit');
pintrk('track', 'addtocart');
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&event=pagevisit&noscript=1" />
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&event=addtocart&noscript=1" />
</noscript>
</head>