snowplow/snowplow-javascript-tracker

View on GitHub
api-docs/docs/browser-tracker/markdown/browser-tracker.trackerconfiguration.md

Summary

Maintainability
Test Coverage
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/browser-tracker](./browser-tracker.md) &gt; [TrackerConfiguration](./browser-tracker.trackerconfiguration.md)

## TrackerConfiguration type

The configuration object for initialising the tracker

<b>Signature:</b>

```typescript
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;
    useExtendedCrossDomainLinker?: ExtendedCrossDomainLinkerOptions;
    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;
    preservePageViewIdForUrl?: PreservePageViewIdForUrl;
};
```

## Example


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

```