Skip to main content

Quick Start

Features

Integrations

Issues

Overview

The Permutive JavaScript SDK enables user segmentation, personalization, and ad targeting on your website. Track user behavior, manage identities, and deliver targeted advertising through integrations with major ad platforms including Google Ad Manager, Prebid.js, and Xandr. Current Version: See your Permutive dashboard for the latest version.
Browser Support: The SDK supports all modern browsers including Chrome, Firefox, Safari, and Edge. It is designed to work in environments without third-party cookies.

Getting Started

New to the Permutive JavaScript SDK? Start here.

Quick Start Guide

Get up and running with your first pageview in minutes

Installation

Script tag and tag manager installation options

Initialization

SDK initialization and configuration options

Verification

Verify your integration is working correctly

Core Concepts

Understand the fundamental concepts of the Permutive SDK.

Identity Management

Track users across sessions and devices

Event Properties

Structure and validate event data

Cohorts and Activations

Understanding user segmentation

Contextual Data

Content-based real-time targeting

Consent Management

GDPR, TCF, and consent handling

Features

Detailed guides for specific SDK features.

Pageview Tracking

Automatic and manual pageview tracking with the web addon

Event Tracking

Track custom events with track(), on(), and once()

Video Tracking

Track video content viewing

Real-Time Triggers

React to cohort changes with trigger(), segment(), and query()

Integrations

Connect Permutive with ad platforms and header bidding solutions.

View All Integrations

Google Ad Manager, Prebid.js, Xandr, and more

Common Tasks

The web addon automatically tracks pageviews when configured. You can also include custom page properties.
permutive.addon('web', {
  page: {
    type: 'article',
    article: {
      title: 'Breaking News: Tech Advances',
      categories: ['technology', 'news'],
      authors: ['Jane Smith'],
      publishedAt: '2024-01-15'
    }
  }
});
permutive.track('Purchase', {
  product_id: 'SKU123',
  product_name: 'Premium Subscription',
  price: 9.99,
  currency: 'USD'
});
// Simple identity
permutive.identify([
  { tag: 'email_sha256', id: 'a1b2c3d4e5f6...' },
  { tag: 'internal_id', id: 'user_12345', priority: 1 }
]);
// Check if user is in a specific cohort
permutive.segment(12345, function(inCohort) {
  if (inCohort) {
    showPremiumContent();
  }
});

// Get all cohorts
permutive.segments(function(segments) {
  console.log('User cohorts:', segments);
});
// Using the DFP addon (automatically sets targeting)
permutive.addon('web', { page: { /* ... */ } });

// Or manually get segments for GPT
permutive.segments(function(segments) {
  googletag.cmd.push(function() {
    googletag.pubads().setTargeting('permutive', segments);
  });
}, 'dfp');

Key API Methods

MethodPurpose
permutive.track(event, properties)Track custom events
permutive.identify(identities)Set user identities
permutive.trigger(code, param, handler)React to cohort entry/exit
permutive.segment(code, handler)Check single cohort membership
permutive.segments(handler, type)Get all cohorts
permutive.query(code, handler)Reserved for future use
permutive.ready(callback, stage)Wait for SDK initialization
permutive.consent(data)Set consent status
permutive.addon(name, options)Initialize addons
permutive.on(event, callback)Persistent event listener
permutive.once(event, callback)Single event listener
permutive.reset()Clear user data

Requirements

RequirementDetails
BrowsersModern browsers (Chrome, Firefox, Safari, Edge)
JavaScriptES5+ (SDK is transpiled for compatibility)
CookiesFirst-party cookies required for identity persistence
localStorageRequired for cohort storage

Installation

Key Concepts

The SDK uses a queue-based loading pattern. Methods called before the SDK loads are queued and executed in order once the SDK initializes. This means you can safely call SDK methods immediately without waiting for load.
  • Cohorts: All segments a user belongs to
  • Activations: Cohorts configured for specific ad platforms (e.g., dfp for Google Ad Manager)
  • Behavioral: Based on user history (e.g., “sports enthusiast”)
  • Contextual: Based on current page content (e.g., viewing sports article right now)
The web addon provides automatic tracking for pageviews, engagement time, form submissions, and link clicks. It’s the recommended way to track user activity.

Additional Resources

FAQ

Yes. The Permutive SDK uses first-party cookies and localStorage, which are not affected by third-party cookie restrictions. It works effectively in Safari, Firefox, and other browsers that block third-party cookies.
Add ?__permutive.loggingEnabled=true to any page URL to enable debug logging in the browser console. You’ll see detailed information about events, cohorts, and SDK activity.
The web addon automatically tracks standard events (Pageview, PageviewEngagement, FormSubmission, LinkClick) with minimal configuration. Use track() for custom events that don’t fit these patterns.
Yes. Call permutive.addon('web', { page: {...} }) on each route change to track new pageviews. See Pageview Tracking for details.

Getting Help

Privacy & Compliance

Permutive is designed with privacy in mind: GDPR compliant, CCPA compliant, no PII storage, user consent respected, and transparent data usage.