Installation Methods
- Script Tag (Recommended)
- Google Tag Manager
- Other Tag Managers
The script tag method is the recommended approach for most websites. It provides the fastest load time and simplest setup.Replace:
Basic Installation
Add to the<head> section of your page, as early as possible:<WORKSPACE_API_KEY>- Your public API key<WORKSPACE_ID>- Your workspace ID<ORGANIZATION_ID>- Your organization ID
With Configuration Options
Pass configuration options as the fourth argument:Understanding the Loader Script
The inline loader script (the first<script> block) does the following:
- Creates the global
permutiveobject if it doesn’t exist - Initializes a queue (
permutive.q) to store method calls before the SDK loads - Sets configuration including API key and workspace ID
- Creates stub methods (
track,identify, etc.) that add calls to the queue
SDK Source Files
The SDK is served from your organization’s edge CDN: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
Load Permutive First
Place the Permutive script tag before other third-party scripts, especially before ad scripts.
Use Async Loading
The
async attribute on the live.js script allows parallel loading without blocking page render.Initialize Web Addon Early
Call
permutive.addon('web', {...}) immediately after the SDK script to capture the pageview event early.Verifying Installation
After installation, verify the SDK is loading correctly:- Add
?permutive_debug=trueto your URL - Open the browser console (F12 > Console)
- Look for
[Permutive]prefixed messages - Check Application > Local Storage for
permutive-*keys
Troubleshooting Installation
SDK not loading
SDK not loading
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
Methods not working
Methods not working
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
Script blocked by CSP
Script blocked by CSP
Symptoms: Console error about Content Security Policy.Solution: Add Permutive domains to your CSP:
Tag manager timing issues
Tag manager timing issues
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