Ads & Pixels

Pinterest Tag

Pinterest Tag is Pinterest's conversion tracking and audience building tool. It measures the actions people take on your site after seeing your Pins, so you can attribute conversions and build retargeting audiences for Pinterest Ads.

Official Pinterest documentation

Integrate with c15t

import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/react';
import { pinterestTag } from '@c15t/scripts/pinterest-tag';

const scripts = [pinterestTag({ tagId: '2613654212508' })];

export function ConsentProvider({ children }: { children: ReactNode }) {
  return (
    <ConsentManagerProvider
      options={{
        mode: 'hosted',
        backendURL: 'https://your-instance.c15t.dev',
        scripts,
      }}
    >
      {children}
    </ConsentManagerProvider>
  );
}

How c15t loads it

  • Category: marketing (Ads & Pixels)
  • Loads when: marketing consent is granted
  • On revocation: persists — c15t calls pintrk('setconsent', false), which stops Pinterest from sending events and clears its first-party cookies without removing the script

Before the loader runs, c15t recreates Pinterest's base code: it defines the pintrk queue stub with version = "3.0", then queues pintrk('load', tagId), pintrk('setconsent', true), and pintrk('page'). Pinterest's core.js replays the queue once it loads.

Configure the integration

You can pass extra load options and disable the default page-visit event when you need finer control:

pinterestTag({
  tagId: '2613654212508',
  loadOptions: {
    em: 'hello@example.com',
  },
  trackPageVisit: false,
});

loadOptions is forwarded as the third argument to pintrk('load', tagId, loadOptions). Pinterest uses em (email) and external_id for enhanced match, and hashes plain values before sending them.

Tracking events in your app

c15t gates the Pinterest Tag from loading until marketing consent is granted. After consent is granted the script stays in the DOM, and c15t calls pintrk('setconsent', false) if consent is later revoked, so Pinterest itself suppresses events.

This means window.pintrk is only defined after the user has granted marketing consent at least once. Use pinterestTagEvent() for typed standard and custom events — it's a no-op until pintrk exists, so it's safe to call before consent, and it doesn't bypass consent afterwards. Guarding with has('marketing') is still good practice so you don't queue events Pinterest will drop:

import { useCallback } from 'react';
import { useConsentManager } from '@c15t/react';
import { pinterestTagEvent } from '@c15t/scripts/pinterest-tag';

function useTrackCheckout() {
  const { has } = useConsentManager();
  return useCallback(() => {
    if (has('marketing')) {
      pinterestTagEvent('checkout', {
        event_id: 'eventId0001',
        value: 99.99,
        order_quantity: 1,
        currency: 'USD',
        order_id: 'X-15148',
        line_items: [
          {
            product_name: 'Parker Boots',
            product_id: '1414',
            product_category: 'Shoes',
            product_price: 99.99,
            product_quantity: 1,
          },
        ],
      });
    }
  }, [has]);
}

function CheckoutButton() {
  const trackCheckout = useTrackCheckout();
  return <button onClick={trackCheckout}>Complete checkout</button>;
}

From plain JavaScript:

import { getOrCreateConsentRuntime } from 'c15t';
import { pinterestTagEvent } from '@c15t/scripts/pinterest-tag';

const { consentStore } = getOrCreateConsentRuntime();

if (consentStore.getState().has('marketing')) {
  pinterestTagEvent('lead', { lead_type: 'newsletter' });
}

Pass event_id when you also send the same event through the Pinterest Conversions API so Pinterest can deduplicate the two. Product details (product_name, product_id, product_price, and so on) go inside line_items, one entry per product — Pinterest ignores them at the top level.

Event names

Pinterest recognises 20 event types for conversion tracking: checkout, addtocart, pagevisit, signup, watchvideo, lead, search, viewcategory, custom, addpaymentinfo, addtowishlist, initiatecheckout, subscribe, viewcontent, contact, schedule, findlocation, customizeproduct, submitapplication, and starttrial. pinterestTagEvent() also accepts any other string as a user-defined event, which Pinterest uses for audience targeting only — it logs a console warning for these.

Which events you need depends on the campaign type. Conversions campaigns require at least one of signup, lead, addtocart, or checkout; catalog sales, conversion insights, dynamic retargeting, and the Verified Merchant Program all require pagevisit, addtocart, and checkout with currency set. See Add event codes for the full matrix.

Debugging with a callback

Pinterest accepts an optional (didInit, error) callback after the event data. Pass it as the third argument to pinterestTagEvent() to surface tag errors during development:

import { pinterestTagEvent } from '@c15t/scripts/pinterest-tag';

pinterestTagEvent('lead', { lead_type: 'Newsletter' }, (didInit, error) => {
  if (!didInit) {
    console.error('Pinterest Tag error:', error);
  }
});

Types

PinterestTagOptions

Warning: ExtractedTypeTable: Could not extract "PinterestTagOptions" from "./packages/scripts/src/vendors/ads-and-pixels/pinterest-tag.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

PinterestTagLoadOptions

Warning: ExtractedTypeTable: Could not extract "PinterestTagLoadOptions" from "./packages/scripts/src/vendors/ads-and-pixels/pinterest-tag.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

PinterestTagEventData

Warning: ExtractedTypeTable: Could not extract "PinterestTagEventData" from "./packages/scripts/src/vendors/ads-and-pixels/pinterest-tag.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

PinterestTagLineItem

Warning: ExtractedTypeTable: Could not extract "PinterestTagLineItem" from "./packages/scripts/src/vendors/ads-and-pixels/pinterest-tag.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

PinterestTagEventCallback

Warning: ExtractedTypeTable: Could not extract "PinterestTagEventCallback" from "./packages/scripts/src/vendors/ads-and-pixels/pinterest-tag.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

Script

Warning: ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…