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.Common Tasks
Track a Pageview
Track a Pageview
The web addon automatically tracks pageviews when configured. You can also include custom page properties.
Track a Custom Event
Track a Custom Event
Set User Identity
Set User Identity
React to Cohort Changes
React to Cohort Changes
Target Google Ads
Target Google Ads
Key API Methods
| Method | Purpose |
|---|---|
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
| Requirement | Details |
|---|---|
| Browsers | Modern browsers (Chrome, Firefox, Safari, Edge) |
| JavaScript | ES5+ (SDK is transpiled for compatibility) |
| Cookies | First-party cookies required for identity persistence |
| localStorage | Required for cohort storage |
Installation
- Script Tag (Recommended)
- Tag Manager
Add to the Replace
<head> of your page, as early as possible:<WORKSPACE_API_KEY>, <WORKSPACE_ID>, and <ORGANIZATION_ID> with your credentials from the Permutive dashboard.Key Concepts
Queue-Based Loading
Queue-Based Loading
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 vs. Activations
Cohorts vs. Activations
- Cohorts: All segments a user belongs to
- Activations: Cohorts configured for specific ad platforms (e.g.,
dfpfor Google Ad Manager)
Behavioral vs. Contextual
Behavioral vs. Contextual
- Behavioral: Based on user history (e.g., “sports enthusiast”)
- Contextual: Based on current page content (e.g., viewing sports article right now)
Web Addon
Web Addon
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
- Guides
- Reference
- Tag Manager Setup - GTM, Tealium, Adobe Launch
- Single Page Applications - React, Vue, Angular integration
FAQ
Does the SDK work without third-party cookies?
Does the SDK work without third-party cookies?
How do I enable debug logging?
How do I enable debug logging?
Add
?permutive_debug=true to any page URL to enable debug logging in the browser console. You’ll see detailed information about events, cohorts, and SDK activity.What's the difference between track() and the web addon?
What's the difference between track() and the web addon?
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.How do I handle consent/GDPR?
How do I handle consent/GDPR?
Set
consentRequired: true in your configuration, then call permutive.consent({ opt_in: true, token: '...' }) after obtaining user consent. See the Consent Management guide for details.Does the SDK support Single Page Applications?
Does the SDK support Single Page Applications?
Yes. The web addon provides a
reset() method for SPA navigation. Call it when the route changes to track new pageviews. See Pageview Tracking for details.Getting Help
- Troubleshooting Guide - Solutions to common issues
- Customer Success Manager - Your primary contact
- Technical Services - Technical integration support
- Support - Troubleshooting and help