Skip to content

Latest commit

 

History

History
124 lines (111 loc) · 13.4 KB

File metadata and controls

124 lines (111 loc) · 13.4 KB

Home > @snowplow/browser-tracker

browser-tracker package

Classes

Class Description
SharedState A set of variables which are shared among all initialised trackers

Functions

Function Description
addGlobalContexts(contexts, trackers) All provided contexts will be sent with every event
addPlugin(configuration, trackers) Add a plugin into the plugin collection after trackers have already been initialised
clearGlobalContexts(trackers) Clear all global contexts that are sent with events
clearUserData(configuration, trackers) Clears all cookies and local storage containing user and session identifiers
crossDomainLinker(crossDomainLinkerCriterion, trackers) Enable querystring decoration for links passing a filter
disableActivityTracking(trackers) Disables page activity tracking.
disableActivityTrackingCallback(trackers) Disables page activity tracking callback.
disableAnonymousTracking(configuration, trackers) 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(enable, trackers) Strip braces from URL
discardHashTag(enable, trackers) Strip hash tag (or anchor) from URL
enableActivityTracking(configuration, trackers) Enables page activity tracking (sends page pings to the Collector regularly).
enableActivityTrackingCallback(configuration, trackers) Enables page activity tracking (replaces collector ping with callback).
enableAnonymousTracking(configuration, trackers) Enables anonymous tracking (ie. tracker initialized without anonymousTracking)
flushBuffer(configuration, trackers) Send all events in the outQueue Only need to use this when sending events with a bufferSize of at least 2
newSession(trackers) Expires current session and starts a new session.
newTracker(trackerId, endpoint, configuration) Initialise a new tracker
preservePageViewId(trackers) Stop regenerating pageViewId (available from web_page context)
removeGlobalContexts(contexts, trackers) All provided contexts will no longer be sent with every event
setBufferSize(newBufferSize, trackers) 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) Specify the Snowplow collector URL. Specific http or https to force it or leave it off to match the website protocol.
setCookiePath(path, trackers) Set first-party cookie path
setCustomUrl(url, trackers) Override url
setDocumentTitle(title, trackers) Override document.title
setOptOutCookie(name, trackers) Sets the opt out cookie.
setReferrerUrl(url, trackers) Override referrer
setUserId(userId, trackers) Set the business-defined user ID for this user.
setUserIdFromCookie(cookieName, trackers) Set the business-defined user ID for this user to the value of a cookie.
setUserIdFromLocation(querystringField, trackers) Set the business-defined user ID for this user using the location querystring.
setUserIdFromReferrer(querystringField, trackers) Set the business-defined user ID for this user using the referrer querystring.
setVisitorCookieTimeout(timeout, trackers) Set visitor cookie timeout (in seconds)
trackPageView(event, trackers) Track a visit to a web page
trackSelfDescribingEvent(event, trackers) 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) 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) Triggers the activityHandler manually to allow external user defined activity. i.e. While watching a video

Interfaces

Interface Description
ActivityTrackingConfiguration The base configuration for activity tracking
ActivityTrackingConfigurationCallback The callback for enableActivityTrackingCallback
BrowserPlugin Interface which defines Core Plugins
BrowserPluginConfiguration The configuration of the plugin to add
BrowserTracker The Browser Tracker
ClearUserDataConfiguration The configuration that can be changed when enabling anonymous tracking
ClientSession Schema for client client session context entity
CommonEventProperties Additional data points to set when tracking an event
ContextEvent Argument for ContextGenerator and ContextFilter callback
CorePlugin Interface which defines Core Plugins
CorePluginConfiguration The configuration of the plugin to add
DeviceTimestamp A representation of a Device Timestamp (dtm)
DisableAnonymousTrackingConfiguration The configuration that can be changed when disabling anonymous tracking
EmitterConfigurationBase
EnableAnonymousTrackingConfiguration The configuration that can be changed when enabling anonymous tracking
EventPayloadAndContext Interface for returning a built event (PayloadBuilder) and context (Array of SelfDescribingJson).
EventStore EventStore allows storing and retrieving events before they are sent to the collector
EventStoreConfiguration
EventStoreIterator EventStoreIterator allows iterating over all events in the store.
EventStorePayload
FlushBufferConfiguration The configuration that can be changed when flushing the buffer
LocalStorageEventStoreConfigurationBase
Logger
PageViewEvent A Page View event Used for tracking a page view
PayloadBuilder Interface for mutable object encapsulating tracker payload
RuleSet A ruleset has accept or reject properties that contain rules for matching Iglu schema URIs
SelfDescribingEvent 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 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 Export interface containing all Core functions
TrueTimestamp A representation of a True Timestamp (ttm)

Variables

Variable Description
version

Type Aliases

Type Alias Description
ActivityCallback The callback for enableActivityTrackingCallback
ActivityCallbackData The data which is passed to the Activity Tracking callback
ActivityMetrics Quantitative activity metrics accumulated between page pings. Attached as a context entity when activityMetrics is enabled.
AnonymousTrackingOptions
BuiltInContexts
ConditionalContextProvider 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 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 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 A context primitive is either a self-describing JSON or a context generator
CookieSameSite
EventBatch A collection of event payloads which are sent to the collector.
EventJson An array of tuples which represents the unprocessed JSON to be added to the Payload
EventMethod
ExtendedCrossDomainLinkerAttributes
ExtendedCrossDomainLinkerOptions
FilterProvider 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 A function which will processor the Json onto the injected PayloadBuilder
ParsedIdCookie The format of state elements stored in the id cookie.
Payload Type for a Payload dictionary
Platform
PreservePageViewIdForUrl
RequestFailure The data that will be available to the onRequestFailure callback
RuleSetProvider 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 Export interface for any Self-Describing JSON such as context or Self Describing events
StateStorageStrategy
Timestamp Algebraic datatype representing possible timestamp type choice
TrackerConfiguration The configuration object for initialising the tracker