After you add the base code, you can add an event code to track a specific conversion event on your website.
The table below shows the events that you can track with the Pinterest tag, and whether they include and
Event |
Purpose |
Audience creation |
Conversion reporting |
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 interest in your product or service |
✔ |
✔ |
Search |
Track people who perform searches on your website to look for specific products or store 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 event that you’ve defined for the purpose of audience targeting. Unique events aren’t available for conversion reporting. Keep in mind that whitespace will be trimmed from raw event names passed through the tag |
✔ |
Placement
Both the base code and event code must be added to any page where you want to track conversions. The base code should be placed on every page of your website, whereas the event code only needs to be placed on pages where you want to track conversions. The base code must run before the event code, so be sure to place it first.
For example, if you want to track successful checkouts, you should place the base code then the checkout event code between the <head> and </head> tags on your checkout confirmation page. This placement ensures that the codes run as soon as the page is loaded.
On the other hand, if an event is triggered only after a user takes a specific action on the page, such as clicking a button or submitting a form, then you need to make sure that the event code runs only as a result of the action. This requires an understanding of the existing event handlers in your page’s JavaScript code.
Event Data
You can provide additional information about an event by attaching an object that contains event data.
Keep in mind we only offer reporting on value and order_quantity event data at this time. Any additional event data is available for audience targeting but is not available for conversion reporting.
Value should be sent back along with the appropriate currency code. We will convert conversion value in Ads Manager reporting to your account currency using the exchange rate between the currency code sent back in the conversion tag and your account's currency.
Event data |
Sample value |
Type |
Location |
Audience creation |
Conversion reporting |
---|---|---|---|---|---|
value |
100 |
Number (integer or floating point) |
Top-level |
✔ |
✔ |
order_quantity |
1 |
Integer |
Top-level |
✔ |
✔ |
product_ids | [ '1414', '1415' ] | Array | Top-level | ✔ | |
promo_code | WINTER10 | String | Top-Level | ✔ | |
property | Athleta | String | Top-level | ✔ | |
search_query | boots | String | Top-level | ✔ | |
video_title | How to style your Parker Boots | String | Top-level | ✔ | |
lead_type | Newsletter | String | Top-level | ✔ | |
product_name |
Parker Boots |
String |
line_items array |
✔ |
|
product_id |
1414 |
String |
line_items array |
✔ |
|
product_category |
Shoes |
String |
line_items array |
✔ |
|
product_variant_id |
1414-Red |
String |
line_items array |
✔ |
|
product_price |
99.99 |
Number (integer or floating point) |
line_items array |
✔ |
|
product_variant |
Red |
String |
line_items array |
✔ |
|
product_quantity |
1 |
Integer |
line_items array |
✔ |
|
product_brand |
Parker |
String |
line_items array |
✔ |
|
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 | Top-level | ✔ |
The example event code below tracks a checkout event with event data describing a purchase of two products. Keep in mind this example is the JavaScript portion of the event code. In this example, order_quantity and value are static, but you may want to
See the value and quantity event data section below for examples of dynamic value and quantity.
<script>
pintrk('track', 'checkout', {
value: 10.00,
order_quantity: 2,
currency: 'USD',
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
}
]
});
</script>
Value and quantity event data
Value and order quantity are the two pieces of event data currently available in conversion reporting. If you want to add value and quantity you can either use static values or pass them back dynamically. If you’d like to pass back value and quantity dynamically as recommended, this will be unique to your website and how you record sales. Typically, the value and quantity of products in each order placed on your website varies. To accurately track the total value of your sales, we recommend a dynamic variable to track quantity and value in your conversion tags.
Example of hard-coded value and quantity:
<script>
pintrk('track', 'checkout', {
value: 10.00, // Read this value (must be a number)
order_quantity: 5 // Read this quantity (must be an integer)
});
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt="" src="https://ct.pinterest.com/v3/?tid=123456789&event=checkout&ed[value]=10.00&ed[order_quantity]=5&noscript=1"/>
</noscript>
Reported value: 10.00
Reported quantity: 5
Example of dynamic value and quantity:
<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 that the setup of dynamic order quantity and value is unique to your website.
Callback
In addition to the event data, you can pass a JavaScript callback function as an optional argument to the function pintrk(). This callback function runs every time when 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.
Example
<script>
pintrk('track', 'checkout', {
value: 10.00,
order_quantity: 2,
currency: 'USD',
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>
Next steps
You can view some more examples here. Once you’ve added your base and event codes you can use the pinterest tag helper to confirm that you’ve implemented the tags correctly.