Home > @snowplow/browser-tracker > BrowserTracker
The Browser Tracker
Signature:
interface BrowserTracker | Property | Type | Description |
|---|---|---|
| addPlugin | (configuration: BrowserPluginConfiguration) => void | Add a plugin into the plugin collection after Tracker has already been initialised |
| clearUserData | (configuration?: ClearUserDataConfiguration) => void | Clears all cookies and local storage containing user and session identifiers |
| core | TrackerCore | The instance of the core library which this tracker has initialised |
| crossDomainLinker | (crossDomainLinkerCriterion: (elt: HTMLAnchorElement | HTMLAreaElement) => boolean) => void | Enable querystring decoration for links passing a filter |
| disableActivityTracking | () => void | Disables page activity tracking. |
| disableActivityTrackingCallback | () => void | Disables page activity tracking callback. |
| disableAnonymousTracking | (configuration?: DisableAnonymousTrackingConfiguration) => void | Disables anonymous tracking if active (ie. tracker initialized with anonymousTracking) For stateStorageStrategy override, uses supplied value first, falls back to one defined in initial config, otherwise uses cookieAndLocalStorage. |
| discardBrace | (enableFilter: boolean) => void | Strip braces from URL |
| discardHashTag | (enableFilter: boolean) => void | Strip hash tag (or anchor) from URL |
| enableActivityTracking | (configuration: ActivityTrackingConfiguration) => void | Enables page activity tracking (sends page pings to the Collector regularly). |
| enableActivityTrackingCallback | (configuration: ActivityTrackingConfiguration & ActivityTrackingConfigurationCallback) => void | Enables page activity tracking (replaces collector ping with callback). |
| enableAnonymousTracking | (configuration?: EnableAnonymousTrackingConfiguration) => void | Enables anonymous tracking (ie. tracker initialized without anonymousTracking) |
| flushBuffer | (configuration?: FlushBufferConfiguration) => void | Send all events in the outQueue Only need to use this when sending events with a bufferSize of at least 2 |
| getCookieName | (basename: string) => void | Get the cookie name as cookieNamePrefix + basename + . + domain. |
| getDomainSessionIndex | () => void | Get the domain session index also known as current memorized visit count. |
| getDomainUserId | () => void | Get visitor ID (from first party cookie) |
| getDomainUserInfo | () => void | Get the visitor information (from first party cookie) |
| getPageViewId | () => string | Get the current page view ID |
| getTabId | () => string | null | Get the current browser tab ID |
| getUserId | () => void | Get the current user ID (as set previously with setUserId()). |
| id | string | The unique identifier of this tracker |
| namespace | string | The tracker namespace |
| newSession | () => void | Expires current session and starts a new session. |
| preservePageViewId | () => void | Stop regenerating pageViewId (available from web_page context) |
| setBufferSize | (newBufferSize: number) => void | Alter buffer size Can be useful if you want to stop batching requests to ensure events start sending closer to event creation |
| setCollectorUrl | (collectorUrl: string) => void | Specify the Snowplow collector URL. Specific http or https to force it or leave it off to match the website protocol. |
| setCookiePath | (path: string) => void | Set first-party cookie path |
| setCustomUrl | (url: string) => void | Override url |
| setDocumentTitle | (title: string) => void | Override document.title |
| setOptOutCookie | (name?: string | null) => void | Sets the opt out cookie. |
| setReferrerUrl | (url: string) => void | Override referrer |
| setUserId | (userId?: string | null) => void | Set the business-defined user ID for this user. |
| setUserIdFromCookie | (cookieName: string) => void | Set the business-defined user ID for this user to the value of a cookie. |
| setUserIdFromLocation | (querystringField: string) => void | Set the business-defined user ID for this user using the location querystring. |
| setUserIdFromReferrer | (querystringField: string) => void | Set the business-defined user ID for this user using the referrer querystring. |
| setVisitorCookieTimeout | (timeout: number) => void | Set visitor cookie timeout (in seconds) |
| sharedState | SharedState | The instance of shared state this tracker is using |
| trackPageView | (event?: PageViewEvent & CommonEventProperties) => void | Log visit to this page |
| updatePageActivity | () => void | Triggers the activityHandler manually to allow external user defined activity. i.e. While watching a video |