Skip to main content
Version: Current platform

SDK Configuration

Pass configuration in the queued init call or to new window.Upsurge(config).

Required and routing options​

OptionTypeDefaultDescription
siteIdstring—Public site identifier. Required. The SDK exchanges it for an origin-bound runtime token.
baseUrlstringwindow.location.originUpsurge 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​

OptionTypeDefaultDescription
batchSizenumber100Events that trigger an immediate batch flush. The ingestion API accepts at most 100 events per batch.
flushIntervalnumber10000Milliseconds between scheduled flushes.
maxQueueSizenumber1000Maximum queued events before overflow handling.
maxRetriesnumber3Retries for network and server failures.
retryDelaynumber1000Initial retry delay in milliseconds.
retryBackoffnumber2Exponential retry multiplier.
sessionTimeoutnumber1800000Inactivity in milliseconds before a new session.

Client errors and rate-limit responses are not retried automatically.

Capture and privacy options​

OptionTypeDefaultDescription
autoTrackPageViewsbooleantrueCapture the initial page view.
autoTrackSpaNavigationbooleantrueCapture History API navigation and refresh page-targeted overlays.
autoTrackEngagementSummariesbooleantrueEmit one bounded dwell, scroll, and interaction summary per page lifecycle.
respectDoNotTrackbooleanfalseDisable tracking when the browser advertises DNT.
enableFingerprintingbooleanfalseOpt in to device fingerprint generation.
debugbooleanfalseWrite diagnostic messages to the console.

Partner attribution options​

Partner attribution is off until partnerAttribution.mode is set.

OptionTypeDefaultDescription
mode'disabled' | 'advertiser' | 'publisher''disabled'Capture inbound advertiser traffic or explicitly track publisher outbound clicks.
attributionWindowDaysnumber30Eligible lookback, clamped to 1–90 days.
maxTouchChainLengthnumber20First-party chain cap, clamped to 1–20 touches.
outboundAllowedHostsstring[][]Exact hosts accepted by publisher URL helpers.
autoDecorateOutboundLinksbooleanfalseDecorate and track only explicitly marked publisher anchors.
voucherMappingsobject{}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​

OptionSignatureRuntime status
onEventQueued(event) => voidCalled after an event enters the queue.
onEventSent(event) => voidCalled once for every event accepted by batch ingestion. Failed events are requeued without invoking it.
onError(error) => voidCalled 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.