Skip to main content

browser-tracker.trackerconfiguration

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;
sessionCookieTimeout?: number;
appId?: string;
platform?: Platform;
respectDoNotTrack?: boolean;
crossDomainLinker?: (elt: HTMLAnchorElement | HTMLAreaElement) => boolean;
useExtendedCrossDomainLinker?: ExtendedCrossDomainLinkerOptions;
discoverRootDomain?: boolean;
stateStorageStrategy?: StateStorageStrategy;
resetActivityTrackingOnPageView?: boolean;
anonymousTracking?: AnonymousTrackingOptions;
contexts?: BuiltInContexts;
plugins?: Array<BrowserPlugin>;
onSessionUpdateCallback?: (updatedSession: ClientSession) => void;
preservePageViewIdForUrl?: PreservePageViewIdForUrl;
synchronousCookieWrite?: boolean;
} & EmitterConfigurationBase & LocalStorageEventStoreConfigurationBase;

Example

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