Who is this for? Marketers and web developers who want passive tracking on marketing sites, landing pages, or web shops — no package install or build step required.
<head> and it starts collecting — no build step or configuration required.
What You Need
- An Immutable Hub account with a project (get started here)
- A publishable API key from your project settings (API keys guide)
- Access to the
<head>tag of the site where you want to install the pixel
Install the Snippet
Paste this into your site’s<head> tag:
YOUR_PUBLISHABLE_KEY with your project’s publishable key from Hub.
This snippet sets
consent to anonymous, which starts collecting anonymous device signals and page views immediately. If your site requires explicit cookie consent before any tracking, see Consent Modes below.Verify the Integration
Open your site with the snippet installed, then check the browser developer tools:- Network tab: Look for a request to
https://cdn.immutable.com/pixel/v1/imtbl.js(the pixel script loading) - Network tab: Look for POST requests to
https://api.immutable.com(events being sent). Events flush every 5 seconds or when 20 events accumulate. - Console: Type
window.__imtblto inspect the command queue
Consent Modes
Theconsent option controls what the pixel collects. The default is none, meaning the pixel loads but does not collect anything until consent is set. See the Data Dictionary for what is collected at each level.
The pixel does not provide a consent UI. You are responsible for building the cookie banner or privacy prompt and calling window.__imtbl.push(['consent', level]) when the user makes a choice.
Setting Consent at Init
To start with the pixel inert (recommended if you have a cookie consent banner):Automatic CMP Detection
If your site uses a Consent Management Platform (such as OneTrust or Cookiebot), the pixel can detect consent state automatically:consentMode is set to auto, the pixel starts in none and checks for these standards:
- Google Consent Mode v2: reads
analytics_storageandad_storagefromwindow.dataLayer - IAB TCF v2: reads purpose consents via
window.__tcfapi
Downgrading Consent
You can downgrade consent at any time. Downgrading tonone purges any PII from the local event queue:
What the Pixel Tracks Automatically
Once consent is set toanonymous or higher, the pixel captures these events with no additional code:
| Event | When it fires | What it captures |
|---|---|---|
| Page view | Every page load | UTM parameters, click IDs (gclid, fbclid, ttclid, msclkid, dclid, li_fat_id), referrer, landing page, referral codes |
| Session start | New session begins | Session ID |
| Session end | Page unload | Session ID, duration in seconds |
| Form submission | HTML form submit | Form action, ID, name, field names. At full consent: SHA-256 hashed email. |
| Outbound link click | Click on external link | Destination URL, link text, element ID |
| Scroll depth | Scroll milestone reached (25%, 50%, 75%, 90%, 100%) | Milestone depth, session ID. On above-the-fold pages: depth and above-fold flag after a 2-second dwell. |
Cross-Subdomain Tracking
To track users across subdomains (e.g.www.example.com and shop.example.com), set the domain option:
Content Security Policy
If your site enforces a Content-Security-Policy header, add these directives:nonce attribute to the inline <script> tag. The nonce covers the inline snippet only — the CDN-loaded script is authorized by the script-src directive above.
Configuration
Init Options
Pass these options to theinit command when initializing the pixel.
| Option | Type | Default | Description |
|---|---|---|---|
key | string | (required) | Your Immutable publishable API key from Hub |
consent | 'none' | 'anonymous' | 'full' | 'none' | Initial consent level |
consentMode | 'auto' | undefined | Enable automatic CMP detection (Google Consent Mode v2, IAB TCF v2). Mutually exclusive with consent. |
domain | string | Current hostname | Cookie domain scope. Set to .example.com for cross-subdomain tracking. |
autocapture.forms | boolean | true | Auto-capture HTML form submissions |
autocapture.clicks | boolean | true | Auto-capture outbound link clicks |
autocapture.scroll | boolean | true | Auto-capture scroll depth milestones |
Command Queue
All commands use thewindow.__imtbl.push() pattern. The command queue buffers calls made before the pixel script finishes loading, then replays them in order.
| Command | Arguments | Description |
|---|---|---|
['init', options] | Init options (see above) | Initialize the pixel. Must be called exactly once. |
['consent', level] | 'none' | 'anonymous' | 'full' | Update the consent level at runtime. Downgrading to none purges PII from the local event queue. |
['page', properties?] | Record<string, unknown> (optional) | Manually fire a page view with optional custom properties. |
page command to manually trigger additional page views — for example, on virtual route changes:
Full SPA support with automatic route change detection is planned for a future release. For now, use manual
page calls or the Web SDK for SPA route tracking.Auto-Capture
By default, the pixel automatically captures form submissions and outbound link clicks. You can disable either or both:Event Delivery
- Events are batched and flushed every 5 seconds or when 20 events accumulate, whichever comes first
- The
session_endevent usesnavigator.sendBeacon()to ensure delivery on page unload - All events include
surface: "pixel"to distinguish them from Web SDK events in the pipeline
FAQ
Can I use the Tracking Pixel and Web SDK together?
Can I use the Tracking Pixel and Web SDK together?
Yes — they’re complementary, not alternatives. The Pixel handles passive capture (page views, attribution, form submissions, outbound clicks) with no code beyond the snippet. Add the Web SDK when you need custom events, user identity, or SPA route tracking.
Will ad blockers affect the pixel?
Will ad blockers affect the pixel?
The pixel uses first-party cookies and standard
fetch() requests, which minimizes interference from ad blockers. First-party domain hosting further reduces this risk.Does the pixel support Single Page Applications?
Does the pixel support Single Page Applications?
The pixel fires a page view on initial load only. For SPA route changes, use the Web SDK’s
page() method. SPA support is planned for a future pixel release.What's the bundle size?
What's the bundle size?
Under 10 KB gzipped. The script loads asynchronously and does not block page rendering.
What browsers are supported?
What browsers are supported?
Chrome 80+, Firefox 78+, Safari 14+, Edge 80+.
How does this work with OneTrust or Cookiebot?
How does this work with OneTrust or Cookiebot?
Next Steps
Data Dictionary
What the pixel collects at each consent level
REST API
Send events from your backend or game server
Web SDK
Typed SDK for SPAs, custom events, and user identity
API Keys
Manage your publishable and secret keys