Server-Side Tracking

Pinterest Conversions API (CAPI) with Server-Side GTM: Complete Deduplication & EMQ Setup Guide

If you advertise on Pinterest without the Pinterest Conversions API (CAPI) running alongside the Pinterest Tag, your Shopping and Catalog campaigns are optimizing with incomplete purchase data. Pinterest shoppers frequently research products on iOS mobile browsers, compare items across multiple sessions over days or weeks, and return via Safari where third-party and short-lived browser cookies are aggressively truncated.

Unlike browser-only pixels, sending conversions server-to-server from your Server-Side Google Tag Manager (sGTM) container connects your checkout directly to Pinterest’s v5/ad_accounts/{ad_account_id}/events endpoint over first-party HTTPS requests.

If you want this implemented, deduplicated, and audited inside your existing GTM workspace, review my Pinterest Conversion Tracking Service or compare turnaround options on my Pricing page.


Why Pinterest Tag Alone Misses Revenue

Most e-commerce brands assume installing the standard Pinterest Tag app in Shopify or WooCommerce is enough. Three technical issues routinely break attribution:

  1. Safari ITP 7-day cookie caps: Pinterest is often an upper- and mid-funnel discovery channel. When a shopper pins or clicks an ad and buys 9 days later on iOS Safari, client-side JavaScript storage for click attribution has already expired unless stored in a first-party HTTP-only server cookie (_epik).
  2. Ad blockers & content blockers: Browser extensions frequently block s.pinimg.com requests outright, preventing checkout and addtocart events from firing.
  3. Weak match rates on guest checkouts: Browser tags rarely capture normalized, lowercase, SHA-256 hashed customer email, phone, and click identifiers cleanly across multi-step or express wallets (Apple Pay, Shop Pay, Klarna).

Dual-Stream Architecture: Pinterest Tag + sGTM CAPI

Pinterest recommends running a redundant setup — firing both the browser Pinterest Tag and Pinterest CAPI from Server-Side GTM — connected by an identical event_id so Pinterest automatically deduplicates overlapping events instead of double-counting orders.

[Shopper Browser]
  ├── 1. Client-Side Pinterest Tag ──► Pinterest Events (event_id: ord_98421)
  └── 2. GA4 / Data Client Event   ──► sGTM Custom Subdomain (metrics.yourdomain.com)
                                            │
                                            ├──► Preserve `_epik` click cookie
                                            ├──► Normalize & SHA-256 hash email/phone
                                            ├──► Verify Consent Mode (`ad_storage`)
                                            └──► Pinterest Conversions API Tag (event_id: ord_98421)

Key Event Mapping Between GA4 and Pinterest

If your sGTM container is already fed by a clean GA4 Web client or Stape Data Tag, map each standard GA4 ecommerce event to Pinterest’s expected event names:

GA4 / DataLayer EventPinterest Event NameRequired / Priority Parameters
page_viewpagevisitevent_id, event_source_url, action_source: "web"
view_itempagevisit (with product metadata)content_ids, content_name, currency, value
add_to_cartaddtocartevent_id, value, currency, num_items, line_items
begin_checkoutinitiatecheckoutevent_id, value, currency, line_items
purchasecheckoutevent_id, order_id, value, currency, num_items, line_items
generate_leadleadevent_id, lead_type, hashed em / ph

Notice the crucial naming difference: GA4 uses begin_checkout for starting checkout, whereas Pinterest expects checkout for the completed purchase and initiatecheckout for starting checkout. Mapping begin_checkout directly to checkout without checking the template will inflate your reported ROAS by 3x–5x immediately.


Step-by-Step Pinterest CAPI Implementation in Server-Side GTM

1. Capture and Preserve the _epik Click Parameter

When a user clicks a Pinterest ad, Pinterest appends ?epik=... to your destination URL.

  • Web GTM: Ensure your Pinterest base tag or first-party helper script reads epik from the URL query string and sets the first-party _epik cookie.
  • Server GTM: Read _epik from incoming cookies (or URL query parameters forwarded inside the sGTM Event Data object) and pass it in the user_data.click_id (or tag Click ID field). Keeping sGTM on a first-party custom subdomain (e.g., metrics.yourstore.com DNS CNAME / A-record aligned with your origin IP) extends cookie survival against Safari ITP restrictions.

2. Generate a Deterministic event_id in Web GTM

Do not generate two random UUIDs inside two separate tags — deduplication will fail completely. Generate a single event_id variable in Web GTM and pass it to:

  1. Your Web Pinterest Tag (event_id field)
  2. Your GA4 Event Tag / Data Tag (event_id event parameter routed to sGTM)

For purchases, combining transaction_id with an event prefix (e.g., checkout_{{Transaction ID}}) guarantees deterministic matching even when webhook fallbacks are introduced later. For funnel events (pagevisit, addtocart), push a unique UUID per DataLayer event or compute one inside a shared Custom JavaScript / Template variable read consistently for the active DataLayer push.

3. Generate a Pinterest API Conversion Access Token

  1. Log in to Pinterest Ads Manager → Ads → Conversions.
  2. Open Conversion Access Token under the API for Conversions section.
  3. Click Generate new token, copy it immediately, and store it securely inside a Server GTM Constant variable (never expose it in Web GTM).
  4. Note your Ad Account ID (numeric ID shown in Ads Manager URL).

4. Configure the Pinterest Conversions API Tag in Server GTM

  1. In your Server GTM workspace, go to Templates → Search Gallery and import the official Pinterest Conversions API tag (maintained by stape-io or Pinterest partner templates; inspect permissions before saving).
  2. Create a new Tag:
    • Ad Account ID: Your Pinterest Ad Account ID.
    • Conversion Access Token: Constant variable created in Step 3.
    • Action Source: web.
    • Event Name Setup Method: Map standard GA4 events (purchase -> checkout, add_to_cart -> addtocart, view_item -> pagevisit, generate_lead -> lead).
    • Event ID: Map directly to {{Event Data - event_id}}.
    • Product / Line Item Mapping: Verify item_id matches the exact SKU/Product ID format uploaded in your Pinterest Catalog feed (e.g., Shopify Product ID vs SKU vs Variant ID — mismatches here break Dynamic Retargeting).
    • User Data Parameters: Pass email (em), phone (ph), first/last name (fn/ln), postal code (zp), city (ct), state (st), country (country), client_ip_address, client_user_agent, and click_id (_epik). Ensure the tag or Server GTM hashes PII with SHA-256 after trimming whitespace and lowercasing.
  3. Trigger: Fire only on incoming GA4 / Data Client events matching your mapped conversion events and respecting consent signals (ad_storage == granted in EEA/UK jurisdictions).

In the EEA and UK, browser consent must control both the Web Pinterest Tag and the Server-Side Pinterest CAPI tag. Do not assume that because traffic hits your own server subdomain you can fire CAPI for opted-out users:

  • Configure sGTM triggers or built-in consent settings so Pinterest CAPI checks Google Consent Mode (gcs / gcd) state carried in the incoming server request.
  • If ad_storage is denied, block or withhold marketing CAPI calls to stay aligned with GDPR / ePrivacy CMP preferences.
  • If you run server-side setups in strict markets like Germany or Norway, pair this with clean Consent Mode v2 GTM configuration.

How to QA & Verify Deduplication Before Go-Live

Never publish a Pinterest CAPI container based solely on HTTP 200 status codes in sGTM Preview. Follow all four checks:

  1. sGTM Preview Payload Check: Place a real test order (with an ?epik=test123 URL parameter attached at landing). Open Server GTM Preview, click the outgoing Pinterest CAPI HTTP request, and verify:
    • event_name is "checkout"
    • event_id matches the browser tag’s event_id byte-for-byte
    • data[0].custom_data.value matches net order revenue without currency formatting errors
    • data[0].user_data.em is a 64-character lowercase SHA-256 hex digest
  2. Pinterest Tag Helper Chrome Extension: Verify the browser tag shows green checkmarks with no duplicate browser fires on thank-you page reloads.
  3. Pinterest Ads Manager → Conversions → Event History / Test Events: Confirm Deduplicated status appears (Browser + API overlap rate climbing steadily without doubling reported checkouts).
  4. 7-Day Order Reconciliation: Compare Pinterest Ads Manager Conversions (Click + View Breakdown) against Shopify/WooCommerce orders tagged from Pinterest UTM campaigns or click IDs.

Frequently Asked Questions

Does Pinterest CAPI replace the browser Pinterest Tag?

No. Pinterest recommends sending both browser Tag events and server-side Conversions API events with matching event_id values. Running both maximizes match rates while preventing event loss when ad blockers suppress client-side scripts.

Why does my Pinterest CAPI Match Rate look low?

Low match rates almost always come from missing _epik click IDs (blocked or missing on landing), hashed uppercase emails, or sending purchase events without billing email/phone in user_data (especially on Shop Pay or Express Checkout thank-you pages where customer data wasn’t exposed cleanly in Web Pixels).

Should order_id or event_id be used for Pinterest deduplication?

You should populate both. event_id paired with event_name handles browser-vs-server deduplication for the same conversion event (checkout), while order_id ensures transaction reconciliation and prevents duplicate purchase reporting if a thank-you page refreshes.

Can you implement Pinterest CAPI alongside Meta CAPI and Google Ads sGTM?

Yes — once your sGTM server container is collecting clean first-party ecommerce events via DataLayer or Shopify Web Pixels, adding Pinterest CAPI reuses the exact same event stream alongside Meta Pixel & CAPI and GA4 without adding extra heavy JavaScript to your storefront. Request a Free Tracking Audit to review your current setup.

Direct Implementation White-Label for Agencies

Need this implemented, audited, or white-labeled?

Whether you are an eCommerce brand owner fixing signal loss or a digital marketing agency needing a senior analytics engineer under strict NDA, I deliver 24–48h SLA turnaround with 8.5+ EMQ match rates.

✓ 24–48h Emergency SLA ✓ Strict Non-Solicitation & NDA ✓ 8.5+ Event Match Quality
Jobair Mahmud

Jobair Mahmud

AI-Driven Performance Marketing & Web Analytics Consultant

Helping eCommerce brands and marketing agencies trust their ads data, scale Smart Bidding, and eliminate wasted ad spend through bulletproof server-side tracking and PPC management.