Pinterest Conversions API
Server-side event delivery to Pinterest's Conversions API for enhanced conversion tracking, bypassing browser limitations for improved data quality.
Pinterest Conversions API is a server destination in the walkerOS flow:
Sends events server-side to Pinterest's Conversions API via raw HTTP (`POST https://api.pinterest.com/v5/ad_accounts/{adAccountId}/events`), hashing 12 user_data fields with SHA-256, as mapped, before transmission. Each event carries the walkerOS event ID as `event_id` for deduplication with the web Pinterest Tag.
Installation
npm install @walkeros/collector @walkeros/server-destination-pinterest- Integrated
- Bundled
import { startFlow } from '@walkeros/collector';
import destinationPinterest from '@walkeros/server-destination-pinterest';
await startFlow({
destinations: {
pinterest: {
code: destinationPinterest,
config: {
settings: {
accessToken: process.env.PINTEREST_ACCESS_TOKEN,
adAccountId: '123456789',
},
},
},
},
});
A complete flow.json with this destination:
{
"version": 4,
"flows": {
"default": {
"config": {
"platform": "server"
},
"destinations": {
"pinterest": {
"package": "@walkeros/server-destination-pinterest",
"config": {
"settings": {
"accessToken": "$secret.PINTEREST_ACCESS_TOKEN",
"adAccountId": "123456789"
}
}
}
}
}
}
}Configuration
This destination uses the standard destination config wrapper (consent, data, env, id, ...). For the shared fields see destination configuration. Package-specific fields live under config.settings and are listed below.
Settings
| Property | Type | Description | More |
|---|---|---|---|
accessToken | string | Pinterest conversion access token for Bearer authentication | |
adAccountId | string | Pinterest ad account ID from Ads Manager | |
action_source | Source of the event (web, app_android, app_ios, offline) | ||
doNotHash | Keys sent as mapped, without normalizing and hashing: their values must already be SHA-256 digests | ||
test | boolean | Enable test mode by appending ?test=true to the API URL | |
url | string | Custom base URL for the Pinterest Conversions API, ending in / | |
user_data | Record<string, string> | Mapping configuration for user data fields | |
partner_name | string | Third-party partner name for attribution | |
ip | any | boolean | Client IP, sent as user_data.client_ip_address. Resolves against { ingest, event }. Default: ["ingest.ip", "event.user.ip"]. false switches it off. A mapped user_data.client_ip_address wins. | |
userAgent | any | boolean | Client user agent, sent as user_data.client_user_agent. Resolves against { ingest, event }. Default: ["ingest.userAgent", "event.user.userAgent"]. false switches it off. A mapped user_data.client_user_agent wins. |
Mapping
This package does not define custom rule-level settings. For the standard rule fields (consent, condition, data, batch, name, policy) see mapping.
Examples
Add to cart
A product add is sent to Pinterest as an add_to_cart conversion with the added item details.
{
"name": "product add",
"data": {
"id": "SKU-B2",
"name": "Cool Cap",
"price": "42.00",
"quantity": 1
},
"context": {
"shopping": [
"intent",
0
]
},
"globals": {
"pagegroup": "shop"
},
"custom": {
"completely": "random"
},
"user": {
"id": "user-456"
},
"nested": [],
"consent": {
"functional": true
},
"id": "a1b2c3d4e5f60002",
"trigger": "click",
"entity": "product",
"action": "add",
"timestamp": 1700000901000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "browser",
"platform": "web",
"url": "https://shop.example.com/products"
}
}{
"name": "add_to_cart",
"data": {
"map": {
"custom_data": {
"map": {
"value": "data.price",
"currency": {
"value": "EUR"
},
"contents": {
"set": [
{
"map": {
"id": "data.id",
"item_name": "data.name",
"item_price": "data.price",
"quantity": {
"key": "data.quantity",
"value": 1
}
}
}
]
}
}
}
}
}
}sendServer("https://api.pinterest.com/v5/ad_accounts/123456789/events", "{\"data\":[{\"event_name\":\"add_to_cart\",\"event_id\":\"a1b2c3d4e5f60002\",\"event_time\":1700000901,\"action_source\":\"web\",\"user_data\":{},\"custom_data\":{\"value\":\"42.00\",\"currency\":\"EUR\",\"contents\":[{\"id\":\"SKU-B2\",\"item_name\":\"Cool Cap\",\"item_price\":\"42.00\",\"quantity\":1}]},\"event_source_url\":\"https://shop.example.com/products\"}]}", {
"headers": {
"Authorization": "Bearer s3cr3t"
}
})Checkout
A completed order is sent to the Pinterest Conversions API as a checkout event with value, currency, and contents.
{
"name": "order complete",
"data": {
"id": "ORD-300",
"value": 249.99,
"currency": "EUR"
},
"context": {
"shopping": [
"complete",
0
]
},
"globals": {
"pagegroup": "shop"
},
"custom": {
"completely": "random"
},
"user": {
"id": "user-123",
"device": "device-456"
},
"nested": [
{
"entity": "product",
"data": {
"id": "SKU-A1",
"name": "Everyday Ruck Snack",
"price": "129.99",
"quantity": 2
}
}
],
"consent": {
"functional": true
},
"id": "a1b2c3d4e5f60001",
"trigger": "load",
"entity": "order",
"action": "complete",
"timestamp": 1700000900000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "browser",
"platform": "web",
"url": "https://shop.example.com"
}
}{
"name": "checkout",
"data": {
"map": {
"custom_data": {
"map": {
"value": "data.value",
"currency": {
"key": "data.currency",
"value": "EUR"
},
"order_id": "data.id",
"num_items": {
"fn": {
"$code": "e=>e.nested.filter(e=>\"product\"===e.entity).length"
}
},
"contents": {
"loop": [
"nested",
{
"condition": {
"$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
},
"map": {
"id": "data.id",
"item_name": "data.name",
"item_price": "data.price",
"quantity": {
"key": "data.quantity",
"value": 1
}
}
}
]
}
}
}
}
}
}sendServer("https://api.pinterest.com/v5/ad_accounts/123456789/events", "{\"data\":[{\"event_name\":\"checkout\",\"event_id\":\"a1b2c3d4e5f60001\",\"event_time\":1700000900,\"action_source\":\"web\",\"user_data\":{},\"custom_data\":{\"value\":249.99,\"currency\":\"EUR\",\"order_id\":\"ORD-300\",\"num_items\":1,\"contents\":[{\"id\":\"SKU-A1\",\"item_name\":\"Everyday Ruck Snack\",\"item_price\":\"129.99\",\"quantity\":2}]},\"event_source_url\":\"https://shop.example.com\"}]}", {
"headers": {
"Authorization": "Bearer s3cr3t"
}
})Page visit
A page view is sent to Pinterest as a page_visit conversion with the source URL.
{
"name": "page view",
"data": {
"domain": "www.example.com",
"title": "walkerOS documentation",
"referrer": "https://www.walkeros.io/",
"search": "?foo=bar",
"hash": "#hash",
"id": "/docs/"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"pagegroup": "docs"
},
"custom": {
"completely": "random"
},
"user": {
"id": "user-789"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "a1b2c3d4e5f60003",
"trigger": "load",
"entity": "page",
"action": "view",
"timestamp": 1700000902000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "browser",
"platform": "web",
"url": "https://www.example.com/docs/"
}
}{
"name": "page_visit"
}sendServer("https://api.pinterest.com/v5/ad_accounts/123456789/events", "{\"data\":[{\"event_name\":\"page_visit\",\"event_id\":\"a1b2c3d4e5f60003\",\"event_time\":1700000902,\"action_source\":\"web\",\"user_data\":{},\"event_source_url\":\"https://www.example.com/docs/\"}]}", {
"headers": {
"Authorization": "Bearer s3cr3t"
}
})Search
A search submit event is forwarded to Pinterest as a search conversion with the query in custom data.
{
"name": "search submit",
"data": {
"term": "walkerOS destinations"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"lang": "elb"
},
"custom": {
"completely": "random"
},
"user": {
"id": "user-101"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "a1b2c3d4e5f60004",
"trigger": "test",
"entity": "search",
"action": "submit",
"timestamp": 1700000903000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "browser",
"platform": "web",
"url": "https://www.example.com/search"
}
}{
"name": "search",
"data": {
"map": {
"custom_data": {
"map": {
"search_string": "data.term"
}
}
}
}
}sendServer("https://api.pinterest.com/v5/ad_accounts/123456789/events", "{\"data\":[{\"event_name\":\"search\",\"event_id\":\"a1b2c3d4e5f60004\",\"event_time\":1700000903,\"action_source\":\"web\",\"user_data\":{},\"custom_data\":{\"search_string\":\"walkerOS destinations\"},\"event_source_url\":\"https://www.example.com/search\"}]}", {
"headers": {
"Authorization": "Bearer s3cr3t"
}
})Signup
A user signup is sent to Pinterest as a signup conversion with the hashed email and external id.
{
"name": "entity action",
"data": {
"method": "email"
},
"context": {
"dev": [
"test",
1
]
},
"globals": {
"lang": "elb"
},
"custom": {
"completely": "random"
},
"user": {
"id": "new-user-1",
"email": "new@example.com"
},
"nested": [
{
"entity": "child",
"data": {
"is": "subordinated"
}
}
],
"consent": {
"functional": true
},
"id": "a1b2c3d4e5f60005",
"trigger": "test",
"entity": "entity",
"action": "action",
"timestamp": 1700000904000,
"timing": 3.14,
"source": {
"count": 1,
"trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
"type": "browser",
"platform": "web",
"url": "https://www.example.com/register"
}
}{
"name": "signup",
"data": {
"map": {
"user_data": {
"map": {
"em": {
"set": [
"user.email"
]
},
"external_id": {
"set": [
"user.id"
]
}
}
}
}
}
}sendServer("https://api.pinterest.com/v5/ad_accounts/123456789/events", "{\"data\":[{\"event_name\":\"signup\",\"event_id\":\"a1b2c3d4e5f60005\",\"event_time\":1700000904,\"action_source\":\"web\",\"user_data\":{\"em\":[\"f0030501023327437b06e5c6f87df7871b8e704ae608d1d0b7b24fdd2a06c716\"],\"external_id\":[\"b45cf5f6ebc2c6974ea3bd9fab19f8cc3a7cf63054727a9fcd22f1fda97d6dde\"]},\"event_source_url\":\"https://www.example.com/register\"}]}", {
"headers": {
"Authorization": "Bearer s3cr3t"
}
})When it fails
- rejected event: Pinterest answers HTTP 200 and reports the event as failed: the push fails with transport, not retryable, and the event goes to the DLQ. Reported as
failedwith codetransport.
Failures
Pinterest can answer HTTP 200 and report an event as failed in the body. That counts as a failed push, not as delivered: the event reaches the dead-letter queue and the collector logs one ERROR line. A response outside the 2xx range, a network error, or no answer within 5 seconds fails the event too: the push answers failed with the code transport (with the HTTP status) or timeout. Without accessToken or adAccountId the destination does not start: every push answers failed with the code config and the collector logs destination init failed. A rule with silent: true sends nothing.
Client IP and user agent
The destination sends the client IP as user_data.client_ip_address and the user agent as user_data.client_user_agent by default. The ip and userAgent settings resolve against { ingest, event } and default to ["ingest.ip", "event.user.ip"] and ["ingest.userAgent", "event.user.userAgent"], so they fill in whenever the source provides them (see the config.ingest recipe on the Express source). A value your mapping sets for user_data.client_ip_address or user_data.client_user_agent wins. A value that resolves to nothing is not sent. Set either setting to false to turn it off, or to another mapping value to read it elsewhere.
Consent
The quickstart sets no config.consent, so Pinterest receives every event, whatever consent the event carries. To send only events with consent, add consent: { marketing: true } to config, next to settings (with several keys listed, one granted key is enough). An event without that consent is skipped or queued, depending on the collector's consentDenied. Server flows built by the CLI skip it and count it in skipped. With startFlow it waits in the destination's queue by default: a later event that carries consent does not release it, and only a walker consent command does, which then sends the waiting events of every user at once. Pass consentDenied: 'skip' to startFlow to skip such events instead (see Gate a destination with consent and consent-denied events on a server).
Hashing
The destination SHA-256 hashes these user_data keys before sending: em, ph, fn, ln, db, ge, ct, st, zp, country, external_id and hashed_maids. A list is hashed item by item, and an empty value is left out. Map personal data only to these keys, in settings.user_data, or under user_data in a rule's data or the destination's config.data.
- Every other key is sent in clear text.
client_ip_addressandclient_user_agentare sent as mapped, and so is any other key: nothing checks the names underuser_data, soemailorphoneinstead ofemandphreaches Pinterest unhashed. Keys mapped outsideuser_dataandcustom_dataare sent at the top level of the event, unhashed. - Values are hashed exactly as mapped, without normalization. Normalize them upstream in the format Pinterest expects, for example the email trimmed and lowercased.
If a value is already hashed, add its key to doNotHash: the destination sends it as mapped, so it must already be a SHA-256 digest.