<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/browser-tracker](./browser-tracker.md)

## browser-tracker package

## Classes

|  Class | Description |
|  --- | --- |
|  [SharedState](./browser-tracker.sharedstate.md) | A set of variables which are shared among all initialised trackers |

## Functions

|  Function | Description |
|  --- | --- |
|  [addGlobalContexts(contexts, trackers)](./browser-tracker.addglobalcontexts.md) | All provided contexts will be sent with every event |
|  [addPlugin(configuration, trackers)](./browser-tracker.addplugin.md) | Add a plugin into the plugin collection after trackers have already been initialised |
|  [clearGlobalContexts(trackers)](./browser-tracker.clearglobalcontexts.md) | Clear all global contexts that are sent with events |
|  [clearUserData(configuration, trackers)](./browser-tracker.clearuserdata.md) | Clears all cookies and local storage containing user and session identifiers |
|  [crossDomainLinker(crossDomainLinkerCriterion, trackers)](./browser-tracker.crossdomainlinker.md) | Enable querystring decoration for links passing a filter |
|  [disableActivityTracking(trackers)](./browser-tracker.disableactivitytracking.md) | Disables page activity tracking. |
|  [disableActivityTrackingCallback(trackers)](./browser-tracker.disableactivitytrackingcallback.md) | Disables page activity tracking callback. |
|  [disableAnonymousTracking(configuration, trackers)](./browser-tracker.disableanonymoustracking.md) | Disables anonymous tracking if active (ie. tracker initialized with <code>anonymousTracking</code>) For stateStorageStrategy override, uses supplied value first, falls back to one defined in initial config, otherwise uses cookieAndLocalStorage. |
|  [discardBrace(enable, trackers)](./browser-tracker.discardbrace.md) | Strip braces from URL |
|  [discardHashTag(enable, trackers)](./browser-tracker.discardhashtag.md) | Strip hash tag (or anchor) from URL |
|  [enableActivityTracking(configuration, trackers)](./browser-tracker.enableactivitytracking.md) | Enables page activity tracking (sends page pings to the Collector regularly). |
|  [enableActivityTrackingCallback(configuration, trackers)](./browser-tracker.enableactivitytrackingcallback.md) | Enables page activity tracking (replaces collector ping with callback). |
|  [enableAnonymousTracking(configuration, trackers)](./browser-tracker.enableanonymoustracking.md) | Enables anonymous tracking (ie. tracker initialized without <code>anonymousTracking</code>) |
|  [flushBuffer(configuration, trackers)](./browser-tracker.flushbuffer.md) | Send all events in the outQueue Only need to use this when sending events with a bufferSize of at least 2 |
|  [newSession(trackers)](./browser-tracker.newsession.md) | Expires current session and starts a new session. |
|  [newTracker(trackerId, endpoint, configuration)](./browser-tracker.newtracker.md) | Initialise a new tracker |
|  [preservePageViewId(trackers)](./browser-tracker.preservepageviewid.md) | Stop regenerating <code>pageViewId</code> (available from <code>web_page</code> context) |
|  [removeGlobalContexts(contexts, trackers)](./browser-tracker.removeglobalcontexts.md) | All provided contexts will no longer be sent with every event |
|  [setBufferSize(newBufferSize, trackers)](./browser-tracker.setbuffersize.md) | Set the buffer size Can be useful if you want to stop batching requests to ensure events start sending closer to event creation |
|  [setCollectorUrl(collectorUrl, trackers)](./browser-tracker.setcollectorurl.md) | Specify the Snowplow collector URL. Specific http or https to force it or leave it off to match the website protocol. |
|  [setCookiePath(path, trackers)](./browser-tracker.setcookiepath.md) | Set first-party cookie path |
|  [setCustomUrl(url, trackers)](./browser-tracker.setcustomurl.md) | Override url |
|  [setDocumentTitle(title, trackers)](./browser-tracker.setdocumenttitle.md) | Override document.title |
|  [setOptOutCookie(name, trackers)](./browser-tracker.setoptoutcookie.md) | Sets the opt out cookie. |
|  [setReferrerUrl(url, trackers)](./browser-tracker.setreferrerurl.md) | Override referrer |
|  [setUserId(userId, trackers)](./browser-tracker.setuserid.md) | Set the business-defined user ID for this user. |
|  [setUserIdFromCookie(cookieName, trackers)](./browser-tracker.setuseridfromcookie.md) | Set the business-defined user ID for this user to the value of a cookie. |
|  [setUserIdFromLocation(querystringField, trackers)](./browser-tracker.setuseridfromlocation.md) | Set the business-defined user ID for this user using the location querystring. |
|  [setUserIdFromReferrer(querystringField, trackers)](./browser-tracker.setuseridfromreferrer.md) | Set the business-defined user ID for this user using the referrer querystring. |
|  [setVisitorCookieTimeout(timeout, trackers)](./browser-tracker.setvisitorcookietimeout.md) | Set visitor cookie timeout (in seconds) |
|  [trackPageView(event, trackers)](./browser-tracker.trackpageview.md) | Track a visit to a web page |
|  [trackSelfDescribingEvent(event, trackers)](./browser-tracker.trackselfdescribingevent.md) | Track a self-describing event happening on this page. A custom event type, allowing for an event to be tracked using your own custom schema and a data object which conforms to the supplied schema |
|  [trackStructEvent(event, trackers)](./browser-tracker.trackstructevent.md) | Track a structured event A classic style of event tracking, allows for easier movement between analytics systems. A loosely typed event, creating a Self Describing event is preferred, but useful for interoperability. |
|  [updatePageActivity(trackers)](./browser-tracker.updatepageactivity.md) | Triggers the activityHandler manually to allow external user defined activity. i.e. While watching a video |

## Interfaces

|  Interface | Description |
|  --- | --- |
|  [ActivityTrackingConfiguration](./browser-tracker.activitytrackingconfiguration.md) | The base configuration for activity tracking |
|  [ActivityTrackingConfigurationCallback](./browser-tracker.activitytrackingconfigurationcallback.md) | The callback for enableActivityTrackingCallback |
|  [BrowserPlugin](./browser-tracker.browserplugin.md) | Interface which defines Core Plugins |
|  [BrowserPluginConfiguration](./browser-tracker.browserpluginconfiguration.md) | The configuration of the plugin to add |
|  [BrowserTracker](./browser-tracker.browsertracker.md) | The Browser Tracker |
|  [ClearUserDataConfiguration](./browser-tracker.clearuserdataconfiguration.md) | The configuration that can be changed when enabling anonymous tracking |
|  [ClientSession](./browser-tracker.clientsession.md) | Schema for client client session context entity |
|  [CommonEventProperties](./browser-tracker.commoneventproperties.md) | Additional data points to set when tracking an event |
|  [ContextEvent](./browser-tracker.contextevent.md) | Argument for [ContextGenerator](./browser-tracker.contextgenerator.md) and [ContextFilter](./browser-tracker.contextfilter.md) callback |
|  [CorePlugin](./browser-tracker.coreplugin.md) | Interface which defines Core Plugins |
|  [CorePluginConfiguration](./browser-tracker.corepluginconfiguration.md) | The configuration of the plugin to add |
|  [DeviceTimestamp](./browser-tracker.devicetimestamp.md) | A representation of a Device Timestamp (dtm) |
|  [DisableAnonymousTrackingConfiguration](./browser-tracker.disableanonymoustrackingconfiguration.md) | The configuration that can be changed when disabling anonymous tracking |
|  [EmitterConfigurationBase](./browser-tracker.emitterconfigurationbase.md) |  |
|  [EnableAnonymousTrackingConfiguration](./browser-tracker.enableanonymoustrackingconfiguration.md) | The configuration that can be changed when enabling anonymous tracking |
|  [EventPayloadAndContext](./browser-tracker.eventpayloadandcontext.md) | Interface for returning a built event (PayloadBuilder) and context (Array of SelfDescribingJson). |
|  [EventStore](./browser-tracker.eventstore.md) | EventStore allows storing and retrieving events before they are sent to the collector |
|  [EventStoreConfiguration](./browser-tracker.eventstoreconfiguration.md) |  |
|  [EventStoreIterator](./browser-tracker.eventstoreiterator.md) | EventStoreIterator allows iterating over all events in the store. |
|  [EventStorePayload](./browser-tracker.eventstorepayload.md) |  |
|  [FlushBufferConfiguration](./browser-tracker.flushbufferconfiguration.md) | The configuration that can be changed when flushing the buffer |
|  [LocalStorageEventStoreConfigurationBase](./browser-tracker.localstorageeventstoreconfigurationbase.md) |  |
|  [Logger](./browser-tracker.logger.md) |  |
|  [PageViewEvent](./browser-tracker.pageviewevent.md) | A Page View event Used for tracking a page view |
|  [PayloadBuilder](./browser-tracker.payloadbuilder.md) | Interface for mutable object encapsulating tracker payload |
|  [RuleSet](./browser-tracker.ruleset.md) | A ruleset has accept or reject properties that contain rules for matching Iglu schema URIs |
|  [SelfDescribingEvent](./browser-tracker.selfdescribingevent.md) | A Self Describing Event A custom event type, allowing for an event to be tracked using your own custom schema and a data object which conforms to the supplied schema |
|  [StructuredEvent](./browser-tracker.structuredevent.md) | A Structured Event A classic style of event tracking, allows for easier movement between analytics systems. A loosely typed event, creating a Self Describing event is preferred, but useful for interoperability. |
|  [TrackerCore](./browser-tracker.trackercore.md) | Export interface containing all Core functions |
|  [TrueTimestamp](./browser-tracker.truetimestamp.md) | A representation of a True Timestamp (ttm) |

## Variables

|  Variable | Description |
|  --- | --- |
|  [version](./browser-tracker.version.md) |  |

## Type Aliases

|  Type Alias | Description |
|  --- | --- |
|  [ActivityCallback](./browser-tracker.activitycallback.md) | The callback for enableActivityTrackingCallback |
|  [ActivityCallbackData](./browser-tracker.activitycallbackdata.md) | The data which is passed to the Activity Tracking callback |
|  [ActivityMetrics](./browser-tracker.activitymetrics.md) | Quantitative activity metrics accumulated between page pings. Attached as a context entity when activityMetrics is enabled. |
|  [AnonymousTrackingOptions](./browser-tracker.anonymoustrackingoptions.md) |  |
|  [BuiltInContexts](./browser-tracker.builtincontexts.md) |  |
|  [ConditionalContextProvider](./browser-tracker.conditionalcontextprovider.md) | Conditional context providers are two element arrays used to decide when to attach contexts, where: - the first element is some conditional criterion - the second element is any number of context primitives |
|  [ContextFilter](./browser-tracker.contextfilter.md) | A context filter is a user-supplied callback that is evaluated for each event to determine if the context associated with the filter should be attached to the event |
|  [ContextGenerator](./browser-tracker.contextgenerator.md) | A context generator is a user-supplied callback that is evaluated for each event to allow an additional context to be dynamically attached to the event |
|  [ContextPrimitive](./browser-tracker.contextprimitive.md) | A context primitive is either a self-describing JSON or a context generator |
|  [CookieSameSite](./browser-tracker.cookiesamesite.md) |  |
|  [EventBatch](./browser-tracker.eventbatch.md) | A collection of event payloads which are sent to the collector. |
|  [EventJson](./browser-tracker.eventjson.md) | An array of tuples which represents the unprocessed JSON to be added to the Payload |
|  [EventMethod](./browser-tracker.eventmethod.md) |  |
|  [ExtendedCrossDomainLinkerAttributes](./browser-tracker.extendedcrossdomainlinkerattributes.md) |  |
|  [ExtendedCrossDomainLinkerOptions](./browser-tracker.extendedcrossdomainlinkeroptions.md) |  |
|  [FilterProvider](./browser-tracker.filterprovider.md) | A filter provider is a tuple that has two parts: a context filter and the context primitive(s) If the context filter evaluates to true, the tracker will attach the context primitive(s) |
|  [JsonProcessor](./browser-tracker.jsonprocessor.md) | A function which will processor the Json onto the injected PayloadBuilder |
|  [ParsedIdCookie](./browser-tracker.parsedidcookie.md) | The format of state elements stored in the <code>id</code> cookie. |
|  [Payload](./browser-tracker.payload.md) | Type for a Payload dictionary |
|  [Platform](./browser-tracker.platform.md) |  |
|  [PreservePageViewIdForUrl](./browser-tracker.preservepageviewidforurl.md) |  |
|  [RequestFailure](./browser-tracker.requestfailure.md) | The data that will be available to the <code>onRequestFailure</code> callback |
|  [RuleSetProvider](./browser-tracker.rulesetprovider.md) | A ruleset provider is aa tuple that has two parts: a ruleset and the context primitive(s) If the ruleset allows the current event schema URI, the tracker will attach the context primitive(s) |
|  [SelfDescribingJson](./browser-tracker.selfdescribingjson.md) | Export interface for any Self-Describing JSON such as context or Self Describing events |
|  [StateStorageStrategy](./browser-tracker.statestoragestrategy.md) |  |
|  [Timestamp](./browser-tracker.timestamp.md) | Algebraic datatype representing possible timestamp type choice |
|  [TrackerConfiguration](./browser-tracker.trackerconfiguration.md) | The configuration object for initialising the tracker |

