Api
API Reference
Complete API reference for the Idlen Pixel SDK
API Reference
This page is a quick command reference. For complete option matrices and payload schema, see Events Reference.
Commands
idlen('init', advertiserId, options?)
Initialize the pixel with your advertiser ID.
// Basic
idlen('init', 'adv_abc123');
// With options
idlen('init', 'adv_abc123', { debug: true });
| Parameter | Type | Required | Description |
|---|---|---|---|
advertiserId | string | Yes | Your advertiser ID from Ads Manager |
options.debug | boolean | No | Enable console logging |
options.autoTrack | boolean | No | Auto-track URL changes |
options.trackHash | boolean | No | Track hash-based route changes |
options.excludeRoutes | string[] | No | Routes excluded from tracking |
options.endpoint | string | No | Custom API endpoint |
idlen('track', 'PageView')
Track a page view event.
idlen('track', 'PageView');
idlen('track', 'Conversion', data?)
Track a conversion event.
// Simple conversion
idlen('track', 'Conversion');
// Named conversion
idlen('track', 'Conversion', { eventName: 'signup' });
// Conversion with value
idlen('track', 'Conversion', {
eventName: 'purchase',
value: 99.99
});
| Parameter | Type | Required | Description |
|---|---|---|---|
data.eventName | string | No | Custom event name |
data.value | number | No | Monetary value |
idlen('track', 'CustomEventName', data?)
Track custom interactions with any event name.
idlen('track', 'FeatureUsed', {
feature: 'export',
format: 'csv'
});
Event Payload
Events sent to the API include:
| Field | Type | Description |
|---|---|---|
aid | string | Advertiser ID |
vid | string | Visitor ID (UUID) |
et | string | Event type (pageview, conversion) |
en | string? | Event name (for conversions) |
ev | number? | Event value (for conversions) |
url | string | Page pathname |
ref | string? | Referrer domain |
ts | number | Timestamp (milliseconds) |
TypeScript Types
interface IdlenOptions {
debug?: boolean;
autoTrack?: boolean;
trackHash?: boolean;
excludeRoutes?: string[];
endpoint?: string;
}
interface ConversionData {
eventName?: string;
value?: number;
}
interface IdlenPixel {
(command: 'init', advertiserId: string, options?: IdlenOptions): void;
(command: 'track', eventType: 'PageView'): void;
(command: 'track', eventType: 'Conversion', data?: ConversionData): void;
(command: 'track', eventType: string, data?: Record<string, unknown>): void;
q?: any[];
}
declare global {
interface Window {
idlen?: IdlenPixel;
}
}
Network
Endpoint: POST https://pixel.idlen.io/v1/track
Method: Uses navigator.sendBeacon() with fallback to fetch()
Rate Limits: 100 requests/minute per IP
Response: 1x1 transparent GIF (for compatibility)
See Events Reference for full event schema and limits.