Skip to main content
The Permutive JavaScript SDK can be installed using several methods. Choose the approach that best fits your deployment workflow.

Installation Methods

Understanding the Loader Script

The inline loader script (the first <script> block) does the following:
  1. Creates the global permutive object if it doesn’t exist
  2. Initializes a queue (permutive.q) to store method calls before the SDK loads
  3. Sets configuration including API key and workspace ID
  4. Creates stub methods (track, identify, etc.) that add calls to the queue
This pattern allows you to call SDK methods immediately without waiting for the SDK to load. Calls are queued and executed in order once the SDK initializes.
// These calls work immediately, even before live.js loads
permutive.identify([{ tag: 'email_sha256', id: 'abc123...' }]);
permutive.track('PageView', { category: 'news' });
permutive.addon('web', { page: { type: 'article' } });

SDK Source Files

The SDK is served from your organization’s edge CDN:
https://<ORGANIZATION_ID>.edge.permutive.app/<WORKSPACE_ID>-web.js
The SDK is served from Permutive’s edge CDN with appropriate caching headers. It typically loads in under 100ms on modern connections.

Load Order Best Practices

1

Load Permutive First

Place the Permutive script tag before other third-party scripts, especially before ad scripts.
2

Use Async Loading

The async attribute on the live.js script allows parallel loading without blocking page render.
3

Initialize Web Addon Early

Call permutive.addon('web', {...}) immediately after the SDK script to capture the pageview event early.
4

Configure Consent Before Tracking

If using consent management, call permutive.consent() before initializing the web addon if consentRequired: true.

Verifying Installation

After installation, verify the SDK is loading correctly:
  1. Add ?permutive_debug=true to your URL
  2. Open the browser console (F12 > Console)
  3. Look for [Permutive] prefixed messages
  4. Check Application > Local Storage for permutive-* keys

Troubleshooting Installation

Symptoms: No permutive object on window, no console messages.Solutions:
  • Verify the script URL is correct (https://<ORGANIZATION_ID>.edge.permutive.app/<WORKSPACE_ID>-web.js)
  • Check for network errors in DevTools > Network tab
  • Ensure the inline loader script runs before the SDK script
  • Check for Content Security Policy (CSP) blocking the script
Symptoms: Calls to permutive.track() or other methods don’t do anything.Solutions:
  • Verify API key and workspace ID are correct
  • Check browser console for error messages
  • Ensure the loader script created stub methods correctly
Symptoms: Console error about Content Security Policy.Solution: Add Permutive domains to your CSP:
script-src 'self' https://*.permutive.app;
connect-src 'self' https://*.permutive.com https://*.permutive.app;
Symptoms: Events missing or SDK not initialized when other tags fire.Solutions:
  • Set Permutive tag priority to highest (e.g., 9999 in GTM)
  • Use permutive.ready() in dependent tags to wait for SDK
  • Ensure trigger fires on “All Pages” before other triggers

Next Steps