SDK Configuration
Pass configuration in the queued init call or to new window.Upsurge(config).
Required and routing options
| Option | Type | Default | Description |
|---|---|---|---|
siteId | string | — | Public site identifier. Required. The SDK exchanges it for an origin-bound runtime token. |
baseUrl | string | window.location.origin | Upsurge application/API origin. Production integrations must set https://dashboard.upsur.ge. |
conversionEventType | 'purchase' | 'checkout_complete' | 'purchase' | Event that receives is_conversion: true. |
Queue and retry options
| Option | Type | Default | Description |
|---|---|---|---|
batchSize | number | 100 | Events that trigger an immediate batch flush. The ingestion API accepts at most 100 events per batch. |
flushInterval | number | 10000 | Milliseconds between scheduled flushes. |
maxQueueSize | number | 1000 | Maximum queued events before overflow handling. |
maxRetries | number | 3 | Retries for network and server failures. |
retryDelay | number | 1000 | Initial retry delay in milliseconds. |
retryBackoff | number | 2 | Exponential retry multiplier. |
sessionTimeout | number | 1800000 | Inactivity in milliseconds before a new session. |
Client errors and rate-limit responses are not retried automatically.
Capture and privacy options
| Option | Type | Default | Description |
|---|---|---|---|
autoTrackPageViews | boolean | true | Capture the initial page view. |
autoTrackSpaNavigation | boolean | true | Capture History API navigation and refresh page-targeted overlays. |
autoTrackEngagementSummaries | boolean | true | Emit one bounded dwell, scroll, and interaction summary per page lifecycle. |
respectDoNotTrack | boolean | false | Disable tracking when the browser advertises DNT. |
enableFingerprinting | boolean | false | Opt in to device fingerprint generation. |
debug | boolean | false | Write diagnostic messages to the console. |
Partner attribution options
Partner attribution is off until partnerAttribution.mode is set.
| Option | Type | Default | Description |
|---|---|---|---|
mode | 'disabled' | 'advertiser' | 'publisher' | 'disabled' | Capture inbound advertiser traffic or explicitly track publisher outbound clicks. |
attributionWindowDays | number | 30 | Eligible lookback, clamped to 1–90 days. |
maxTouchChainLength | number | 20 | First-party chain cap, clamped to 1–20 touches. |
outboundAllowedHosts | string[] | [] | Exact hosts accepted by publisher URL helpers. |
autoDecorateOutboundLinks | boolean | false | Decorate and track only explicitly marked publisher anchors. |
voucherMappings | object | {} | Merchant-owned voucher code to provider/partner mappings. |
partnerAttribution: {
mode: 'advertiser',
attributionWindowDays: 30,
maxTouchChainLength: 20,
voucherMappings: {
CREATOR10: { provider: 'awin', partnerId: '12345' },
},
}
Advertiser mode automatically detects AWIN awc and CJ cjevent on initialization. Provider IDs, publisher references, partner IDs, sub-IDs, and vouchers remain distinct. Arbitrary unmapped voucher query values are ignored.
Advertiser mode also resolves eligible partner-experiment assignments before campaign modules load. Publisher automatic decoration requires exact allowlisted hosts and anchors marked with data-upsurge-partner-provider plus data-upsurge-click-reference.
Callbacks
| Option | Signature | Runtime status |
|---|---|---|
onEventQueued | (event) => void | Called after an event enters the queue. |
onEventSent | (event) => void | Called once for every event accepted by batch ingestion. Failed events are requeued without invoking it. |
onError | (error) => void | Called for transport or runtime errors handled by the SDK. |
Production-oriented example
window.UpsurgeQueue = window.UpsurgeQueue || [];
window.UpsurgeQueue.push([
'init',
{
siteId: 'site_replace_me',
baseUrl: 'https://dashboard.upsur.ge',
conversionEventType: 'purchase',
batchSize: 50,
flushInterval: 5000,
autoTrackPageViews: true,
autoTrackSpaNavigation: true,
respectDoNotTrack: true,
enableFingerprinting: false,
onError(error) {
console.error('Upsurge SDK error', error);
},
},
]);
Do not pass the internal preloadedOverlays or preloadedChatbots test/demo options in a production storefront integration.