Skip to main content
The SDK initializes automatically when the live.js script loads. Configuration options are passed in the loader script and control SDK behavior.

Basic Initialization

The standard initialization passes your credentials and optional configuration:

Configuration Options

Pass configuration options as the fourth argument to the loader function:

Available Options

When consentRequired: true, the SDK will not track any events until consent is granted:
With consentRequired: true, all tracking is blocked until permutive.consent() is called with opt_in: true. Events called before consent are not queued - they are discarded.

Web Addon Configuration

The web addon is initialized separately and handles automatic tracking. Call it after the SDK loads:

Web Addon Options

Page Property Examples

Waiting for SDK Ready

Use permutive.ready() to execute code after the SDK initializes:

Ready Stages

The ready() method accepts an optional stage parameter:

Initialization Order

For optimal performance, follow this initialization order:
1

Loader Script

The inline loader script runs first, creating the queue and stub methods.
2

Consent (if required)

If using consentRequired: true, call permutive.consent() after obtaining user consent.
3

Identify (if available)

If you have user identity (e.g., logged-in user), call permutive.identify() early.
4

Web Addon

Initialize the web addon to start tracking pageviews and engagement.
5

Other Addons

Initialize other addons (DFP, Prebid, etc.) after the web addon.

Example: Complete Initialization

The SDK uses a first-party cookie to persist user identity. Configure the cookie domain for cross-subdomain tracking:
Set cookieDomain to your root domain (with leading dot) to track users across subdomains like www.example.com and blog.example.com.

Environment Configuration

For testing environments, you may want different configurations:

Troubleshooting Initialization

Problem: No console messages, permutive.ready() callback never fires.Solutions:
  • Check that API key and workspace ID are correct
  • Verify live.js is loading (check Network tab)
  • Look for errors in the console
  • Ensure the loader script runs before live.js
Problem: Events are called but nothing appears in dashboard.Cause: consentRequired: true but consent() was not called.Solution: Call permutive.consent({ opt_in: true, token: '...' }) after obtaining user consent.
Problem: SDK initializes but no Pageview events.Solutions:
  • Verify permutive.addon('web', {...}) is called
  • Check that consent has been granted (if consentRequired: true)
  • Enable debug mode to see detailed logging
Problem: Calling segments() in ready() callback returns empty array.Solution: Use the 'realtime' stage:

Next Steps

Verification

Verify your integration is working

Pageview Tracking

Customize pageview tracking