Skip to main content

browser-tracker.trackercore

Home > @snowplow/browser-tracker > TrackerCore

TrackerCore interface

Export interface containing all Core functions

Signature:
interface TrackerCore 

Properties

PropertyTypeDescription
addPayloadPair(key: string, value: unknown) => voidSet a persistent key-value pair to be added to every payload
track(pb: PayloadBuilder, context?: Array<SelfDescribingJson> | null, timestamp?: Timestamp | null) => Payload | undefinedCall with a payload from a buildX function Adds context and payloadPairs name-value pairs to the payload Applies the callback to the built payload

Methods

MethodDescription
addGlobalContexts(contexts)Adds contexts globally, contexts added here will be attached to all applicable events
addPayloadDict(dict)Merges a dictionary into payloadPairs
addPlugin(configuration)Add a plugin into the plugin collection after Core has already been initialised
clearGlobalContexts()Removes all global contexts
getBase64Encoding()Get current base64 encoding state
removeGlobalContexts(contexts)Removes previously added global context, performs a deep comparison of the contexts or conditional contexts
resetPayloadPairs(dict)Replace payloadPairs with a new dictionary
setAppId(appId)Set the application ID
setBase64Encoding(encode)Turn base 64 encoding on or off
setColorDepth(depth)Set the color depth
setIpAddress(ip)Set the IP address
setLang(lang)Set the language
setPlatform(value)Set the platform
setScreenResolution(width, height)Set the screen resolution
setTimezone(timezone)Set the timezone
setTrackerNamespace(name)Set the tracker namespace
setTrackerVersion(version)Set the tracker version
setUseragent(useragent)Set the Useragent
setUserId(userId)Set the user ID
setViewport(width, height)Set the viewport dimensions