How to Install the Pinterest Tag on Your Website | OpsBlu Docs

How to Install the Pinterest Tag on Your Website

Step-by-step Pinterest Tag installation and Conversions API setup for conversion tracking across web, mobile, and server environments.

Deployment Strategy

  • Preferred: Google Tag Manager with Pinterest Tag base code and event-specific tags for standard and custom events.
  • Enforce consent mode integration with your CMP (OneTrust, Cookiebot) to respect user privacy choices before tag fires.
  • Use GTM variables for environment-specific tag IDs and test modes to avoid mixing dev/staging data with production.
  • Consider Conversions API for server-side redundancy and privacy-compliant tracking, especially for high-value events like purchases and signups.

Tag Manager Deployment

  • Create a base Pinterest Tag in GTM that fires on all pages with your tag ID.
  • Build separate event tags for each standard event (PageVisit, ViewCategory, AddToCart, Checkout) triggered by dataLayer pushes or page-specific rules.
  • Bind tag ID, API credentials, and consent state to GTM variables per environment.
  • Use GTM Preview mode to validate tag firing, event parameters, and consent signal integration before publishing.
  • Test Enhanced Match parameters (hashed email, phone) in Pinterest Ads Manager Event History to confirm proper formatting.

Direct Embed or Hard-Coded Scripts

  • If GTM is not available, place the Pinterest Tag base code in the document <head> section with async loading.
  • Add pintrk('load', 'TAG_ID') followed by pintrk('page') immediately after the base code for PageVisit tracking.
  • For event tracking, call pintrk('track', 'EventName', {parameters}) on user actions (button clicks, form submissions, checkout steps).
  • Keep tag IDs environment-aware via server-rendered variables or feature flags so staging never sends data to production tags.
  • Implement consent checks before initializing the tag to comply with GDPR and CCPA requirements.

Base Tag Code Example:

<script>
!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', 'YOUR_TAG_ID', {em: '<user_email_address>'});
pintrk('page');
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt=""
  src="https://ct.pinterest.com/v3/?event=init&tid=YOUR_TAG_ID&noscript=1" />
</noscript>

Mobile & App SDKs

  • Use Pinterest SDK for iOS and Android to track app events that mirror web tag events.
  • Initialize the SDK with your Pinterest App ID and enable automatic app event tracking for installs and app opens.
  • Manually log custom events with Pinterest.logEvent() for in-app actions aligned with your tracking plan.
  • Configure test mode in the SDK during development to validate mobile event payloads.
  • Align event names and parameters between web tag and mobile SDK for consistent cross-platform reporting.

Server-Side Collection (Conversions API)

  • Deploy Conversions API endpoints on your backend to send server-side events for high-value conversions (purchases, leads, signups).
  • Use the same event names as the tag to enable Pinterest's deduplication logic (match on event_id and event_time).
  • Send hashed user data (email, phone, first name, last name, city, state, zip) and browser information (user_agent, IP address) for improved matching.
  • Retrieve _epik cookie (Pinterest click ID) from the user's browser and pass it to your server for API events.
  • Implement retry logic, error logging, and monitoring for API requests to surface failed events quickly.
  • Test server events in Pinterest Ads Manager Event History before enabling production traffic.

API Endpoint Example:

POST https://api.pinterest.com/v5/ad_accounts/{ad_account_id}/events

Headers:

  • Authorization: Bearer YOUR_ACCESS_TOKEN
  • Content-Type: application/json

Payload Structure:

{
  "data": [
    {
      "event_name": "checkout",
      "action_source": "web",
      "event_time": 1640000000,
      "event_id": "order_12345",
      "event_source_url": "https://example.com/checkout",
      "user_data": {
        "em": ["hashed_email"],
        "ph": ["hashed_phone"],
        "client_ip_address": "192.0.2.1",
        "client_user_agent": "Mozilla/5.0...",
        "click_id": "_epik_cookie_value"
      },
      "custom_data": {
        "currency": "USD",
        "value": "79.99",
        "content_ids": ["SKU_12345"],
        "num_items": 2,
        "order_id": "order_12345"
      }
    }
  ]
}

Validation Checklist

  • Check Pinterest Tag Helper extension for tag status, event firing, and parameter accuracy on key pages.
  • Review Ads Manager Event History for both tag and API events, confirming event names, parameters, and deduplication.
  • Verify Enhanced Match coverage by reviewing the percentage of events with hashed email or phone data.
  • Confirm domain ownership in Pinterest Business Hub and tag installation status.
  • Screenshot GTM Preview and Ads Manager Event History for documentation and compliance evidence.

Configuration Recommendations

Enhanced Match: Enable automatic Enhanced Match in Pinterest Tag settings (Ads Manager → Conversions → Tag Settings) if your site has standard email/phone form fields. Use manual hashing only when form fields are non-standard or you need control over which fields are sent. Enhanced Match typically improves attribution by 15-30%.

Tag Consolidation: Use one Pinterest tag per Business Account across all properties. If you have multiple tag IDs from legacy implementations, consolidate to a single tag and update all placements. Historical data stays with the original tag ID in reporting.

Conversions API Scope: Implement CAPI for all conversion events (not just high-value) if your audience has high ad blocker usage. For most sites, CAPI for checkout, signup, and lead events is sufficient. Always implement pixel + CAPI together with event_id deduplication for maximum accuracy.

E-commerce Plugins: Use Pinterest's official integrations for Shopify, WooCommerce, or Magento when available. These handle tag installation, product catalog sync, and CAPI setup automatically with minimal configuration.