Skip to content

Latest commit

 

History

History
62 lines (52 loc) · 1.84 KB

File metadata and controls

62 lines (52 loc) · 1.84 KB

Home > @snowplow/browser-tracker > TrackerConfiguration

TrackerConfiguration type

The configuration object for initialising the tracker

Signature:

type TrackerConfiguration = {
    encodeBase64?: boolean;
    cookieDomain?: string;
    cookieName?: string;
    cookieSameSite?: CookieSameSite;
    cookieSecure?: boolean;
    cookieLifetime?: number;
    withCredentials?: boolean;
    sessionCookieTimeout?: number;
    appId?: string;
    platform?: Platform;
    respectDoNotTrack?: boolean;
    eventMethod?: EventMethod;
    postPath?: string;
    useStm?: boolean;
    bufferSize?: number;
    crossDomainLinker?: (elt: HTMLAnchorElement | HTMLAreaElement) => boolean;
    maxPostBytes?: number;
    maxGetBytes?: number;
    discoverRootDomain?: boolean;
    stateStorageStrategy?: StateStorageStrategy;
    maxLocalStorageQueueSize?: number;
    resetActivityTrackingOnPageView?: boolean;
    connectionTimeout?: number;
    anonymousTracking?: AnonymousTrackingOptions;
    contexts?: BuiltInContexts;
    plugins?: Array<BrowserPlugin>;
    customHeaders?: Record<string, string>;
    retryStatusCodes?: number[];
    dontRetryStatusCodes?: number[];
    onSessionUpdateCallback?: (updatedSession: ClientSession) => void;
    idService?: string;
    retryFailedRequests?: boolean;
    onRequestSuccess?: (data: EventBatch) => void;
    onRequestFailure?: (data: RequestFailure) => void;
};

Example

newTracker('sp1', 'collector.my-website.com', {
 appId: 'my-app-id',
 platform: 'web',
 plugins: [ PerformanceTimingPlugin(), AdTrackingPlugin() ],
 stateStorageStrategy: 'cookieAndLocalStorage'
});