Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Tracker

Hierarchy

  • Core
    • Tracker

Index

Properties

addPayloadPair

addPayloadPair: (key: string, value: string) => void

Set a persistent key-value pair to be added to every payload

param

Field name

param

Field value

Type declaration

    • (key: string, value: string): void
    • Parameters

      • key: string
      • value: string

      Returns void

setDomainUserId

setDomainUserId: (userId: string) => void

Set the domain user ID

param

The domain user id

Type declaration

    • (userId: string): void
    • Parameters

      • userId: string

      Returns void

setNetworkUserId

setNetworkUserId: (userId: string) => void

Set the network user ID

param

The network user id

Type declaration

    • (userId: string): void
    • Parameters

      • userId: string

      Returns void

trackEcommerceTransactionWithItems

trackEcommerceTransactionWithItems: (orderId: string, affiliation: string, total: string, tax?: undefined | string, shipping?: undefined | string, city?: undefined | string, state?: undefined | string, country?: undefined | string, currency?: undefined | string, items?: Array<EcommerceTransactionItem>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp) => PayloadData

Track an ecommerce transaction and all items in that transaction Each item is represented by an EcommerceTransactionItem interface.

param

Internal unique order id number for this transaction.

param

Partner or store affiliation.

param

Total amount of the transaction.

param

Tax amount of the transaction.

param

Shipping charge for the transaction.

param

City to associate with transaction.

param

State to associate with transaction.

param

Country to associate with transaction.

param

Currency to associate with this transaction.

param

Items which make up the transaction.

param

Context relating to the event.

param

Timestamp for the event.

Type declaration

    • (orderId: string, affiliation: string, total: string, tax?: undefined | string, shipping?: undefined | string, city?: undefined | string, state?: undefined | string, country?: undefined | string, currency?: undefined | string, items?: Array<EcommerceTransactionItem>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp): PayloadData
    • Parameters

      • orderId: string
      • affiliation: string
      • total: string
      • Optional tax: undefined | string
      • Optional shipping: undefined | string
      • Optional city: undefined | string
      • Optional state: undefined | string
      • Optional country: undefined | string
      • Optional currency: undefined | string
      • Optional items: Array<EcommerceTransactionItem>
      • Optional context: Array<SelfDescribingJson>
      • Optional tstamp: Timestamp

      Returns PayloadData

trackSelfDescribingEvent

trackSelfDescribingEvent: (properties: Record<string, unknown>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)) => PayloadData

Log an self-describing (previously unstruct) event

param

Contains the properties and schema location for the event

param

Custom contexts relating to the event

param

Timestamp of the event

param

A callback function triggered after event is tracked

returns

Payload

Type declaration

    • (properties: Record<string, unknown>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
    • Parameters

      • properties: Record<string, unknown>
      • Optional context: Array<SelfDescribingJson>
      • Optional tstamp: Timestamp
      • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      Returns PayloadData

trackUnstructEvent

trackUnstructEvent: (properties: Record<string, unknown>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)) => PayloadData

Log an unstructured event

deprecated

use trackSelfDescribingEvent instead

param

Contains the properties and schema location for the event

param

Custom contexts relating to the event

param

Timestamp of the event

param

A callback function triggered after event is tracked

returns

Payload

Type declaration

    • (properties: Record<string, unknown>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
    • Parameters

      • properties: Record<string, unknown>
      • Optional context: Array<SelfDescribingJson>
      • Optional tstamp: Timestamp
      • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      Returns PayloadData

Methods

addGlobalContexts

  • addGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive>): void
  • Adds contexts globally, contexts added here will be attached to all applicable events

    Parameters

    • contexts: Array<ConditionalContextProvider | ContextPrimitive>

      An array containing either contexts or a conditional contexts

    Returns void

addPayloadDict

  • addPayloadDict(dict: PayloadDictionary): void
  • Merges a dictionary into payloadPairs

    Parameters

    • dict: PayloadDictionary

      Adds a new payload dictionary to the existing one

    Returns void

clearGlobalContexts

  • clearGlobalContexts(): void
  • Removes all global contexts

    Returns void

removeGlobalContexts

  • removeGlobalContexts(contexts: Array<ConditionalContextProvider | ContextPrimitive>): void
  • Removes previously added global context, performs a deep comparison of the contexts or conditional contexts

    Parameters

    • contexts: Array<ConditionalContextProvider | ContextPrimitive>

      An array containing either contexts or a conditional contexts

    Returns void

resetPayloadPairs

  • resetPayloadPairs(dict: PayloadDictionary): void
  • Replace payloadPairs with a new dictionary

    Parameters

    • dict: PayloadDictionary

      Resets all current payload pairs with a new dictionary of pairs

    Returns void

setAppId

  • setAppId(appId: string): void
  • Set the application ID

    Parameters

    • appId: string

      An application ID which identifies the current application

    Returns void

setBase64Encoding

  • setBase64Encoding(encode: boolean): void
  • Turn base 64 encoding on or off

    Parameters

    • encode: boolean

      Whether to encode payload

    Returns void

setColorDepth

  • setColorDepth(depth: string): void
  • Set the color depth

    Parameters

    • depth: string

      A color depth value as string

    Returns void

setIpAddress

  • setIpAddress(ip: string): void
  • Set the IP address

    Parameters

    • ip: string

      An IP Address string

    Returns void

setLang

  • setLang(lang: string): void
  • Set the language

    Parameters

    • lang: string

      A language string e.g. 'en-UK'

    Returns void

setPlatform

  • setPlatform(value: string): void
  • Set the platform

    Parameters

    • value: string

      A valid Snowplow platform value

    Returns void

setScreenResolution

  • setScreenResolution(width: string, height: string): void
  • Set the screen resolution

    Parameters

    • width: string

      screen resolution width

    • height: string

      screen resolution height

    Returns void

setTimezone

  • setTimezone(timezone: string): void
  • Set the timezone

    Parameters

    • timezone: string

      A timezone string

    Returns void

setTrackerNamespace

  • setTrackerNamespace(name: string): void
  • Set the tracker namespace

    Parameters

    • name: string

      The trackers namespace

    Returns void

setTrackerVersion

  • setTrackerVersion(version: string): void
  • Set the tracker version

    Parameters

    • version: string

      The version of the current tracker

    Returns void

setUserId

  • setUserId(userId: string): void
  • Set the user ID

    Parameters

    • userId: string

      The custom user id

    Returns void

setUseragent

  • setUseragent(useragent: string): void
  • Set the Useragent

    Parameters

    • useragent: string

      A useragent string

    Returns void

setViewport

  • setViewport(width: string, height: string): void
  • Set the viewport dimensions

    Parameters

    • width: string

      viewport width

    • height: string

      viewport height

    Returns void

trackAdClick

  • trackAdClick(targetUrl: string, clickId: string, costModel: string, cost: number, bannerId: string, zoneId: string, impressionId: string, advertiserId: string, campaignId: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an ad being clicked

    Parameters

    • targetUrl: string

      (required) The link's target URL

    • clickId: string

      Identifier for the ad click

    • costModel: string

      The cost model. 'cpa', 'cpc', or 'cpm'

    • cost: number

      Cost

    • bannerId: string

      Identifier for the ad banner displayed

    • zoneId: string

      Identifier for the ad zone

    • impressionId: string

      Identifier for a particular ad impression

    • advertiserId: string

      Identifier for the advertiser

    • campaignId: string

      Identifier for the campaign which the banner belongs to

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackAdConversion

  • trackAdConversion(conversionId: string, costModel: string, cost: number, category: string, action: string, property: string, initialValue: number, advertiserId: string, campaignId: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an ad conversion event

    Parameters

    • conversionId: string

      Identifier for the ad conversion event

    • costModel: string

      The cost model. 'cpa', 'cpc', or 'cpm'

    • cost: number

      Cost

    • category: string

      The name you supply for the group of objects you want to track

    • action: string

      A string that is uniquely paired with each category

    • property: string

      Describes the object of the conversion or the action performed on it

    • initialValue: number

      Revenue attributable to the conversion at time of conversion

    • advertiserId: string

      Identifier for the advertiser

    • campaignId: string

      Identifier for the campaign which the banner belongs to

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackAdImpression

  • trackAdImpression(impressionId: string, costModel: string, cost: number, targetUrl: string, bannerId: string, zoneId: string, advertiserId: string, campaignId: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an ad being served

    Parameters

    • impressionId: string

      Identifier for a particular ad impression

    • costModel: string

      The cost model. 'cpa', 'cpc', or 'cpm'

    • cost: number

      Cost

    • targetUrl: string

      URL ad pointing to

    • bannerId: string

      Identifier for the ad banner displayed

    • zoneId: string

      Identifier for the ad zone

    • advertiserId: string

      Identifier for the advertiser

    • campaignId: string

      Identifier for the campaign which the banner belongs to

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackAddToCart

  • trackAddToCart(sku: string, name: string, category: string, unitPrice: string, quantity: string, currency?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an add-to-cart event

    Parameters

    • sku: string

      Item's SKU code.

    • name: string

      Product name.

    • category: string

      Product category.

    • unitPrice: string

      Product price.

    • quantity: string

      Quantity added.

    • Optional currency: undefined | string

      Product price currency.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackConsentGranted

  • trackConsentGranted(id: string, version: string, name?: undefined | string, description?: undefined | string, expiry?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a consent granted event

    Parameters

    • id: string

      ID number associated with document.

    • version: string

      Version number of document.

    • Optional name: undefined | string

      Name of document.

    • Optional description: undefined | string

      Description of document.

    • Optional expiry: undefined | string

      Date-time when consent expires.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event.

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackConsentWithdrawn

  • trackConsentWithdrawn(all: boolean, id?: undefined | string, version?: undefined | string, name?: undefined | string, description?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a consent withdrawn event

    Parameters

    • all: boolean

      Indicates user withdraws consent for all documents.

    • Optional id: undefined | string

      ID number associated with document.

    • Optional version: undefined | string

      Version number of document.

    • Optional name: undefined | string

      Name of document.

    • Optional description: undefined | string

      Description of document.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event.

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackEcommerceTransaction

  • trackEcommerceTransaction(orderId: string, affiliation: string, totalValue: string, taxValue?: undefined | string, shipping?: undefined | string, city?: undefined | string, state?: undefined | string, country?: undefined | string, currency?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an ecommerce transaction

    Parameters

    • orderId: string

      Internal unique order id number for this transaction.

    • affiliation: string

      Partner or store affiliation.

    • totalValue: string

      Total amount of the transaction.

    • Optional taxValue: undefined | string

      Tax amount of the transaction.

    • Optional shipping: undefined | string

      Shipping charge for the transaction.

    • Optional city: undefined | string

      City to associate with transaction.

    • Optional state: undefined | string

      State to associate with transaction.

    • Optional country: undefined | string

      Country to associate with transaction.

    • Optional currency: undefined | string

      Currency to associate with this transaction.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackEcommerceTransactionItem

  • trackEcommerceTransactionItem(orderId: string, sku: string, name: string, category: string, price: string, quantity: string, currency?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an ecommerce transaction item

    Parameters

    • orderId: string

      Required Order ID of the transaction to associate with item.

    • sku: string

      Item's SKU code.

    • name: string

      Product name.

    • category: string

      Product category.

    • price: string

      Product price.

    • quantity: string

      Purchase quantity.

    • Optional currency: undefined | string

      Product price currency.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackFormFocusOrChange

  • trackFormFocusOrChange(schema: string, formId: string, elementId: string, nodeName: string, type: string, elementClasses: Array<string>, value: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track the value of a form field changing or receiving focus

    Parameters

    • schema: string

      The schema type of the event

    • formId: string

      The parent form ID

    • elementId: string

      ID of the changed element

    • nodeName: string

      "INPUT", "TEXTAREA", or "SELECT"

    • type: string

      Type of the changed element if its type is "INPUT"

    • elementClasses: Array<string>

      List of classes of the changed element

    • value: string

      The new value of the changed element

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackFormSubmission

  • trackFormSubmission(formId: string, formClasses: Array<string>, elements: Array<Record<string, unknown>>, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a form submission event

    Parameters

    • formId: string

      ID of the form

    • formClasses: Array<string>

      Classes of the form

    • elements: Array<Record<string, unknown>>

      Mutable elements within the form

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackLinkClick

  • trackLinkClick(targetUrl: string, elementId: string, elementClasses: Array<string>, elementTarget: string, elementContent: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Log the link or click with the server

    Parameters

    • targetUrl: string
    • elementId: string
    • elementClasses: Array<string>
    • elementTarget: string
    • elementContent: string

      innerHTML of the link

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackPagePing

  • trackPagePing(pageUrl: string, pageTitle: string, referrer: string, minXOffset: number, maxXOffset: number, minYOffset: number, maxYOffset: number, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Log that a user is still viewing a given page by sending a page ping

    Parameters

    • pageUrl: string

      Current page URL

    • pageTitle: string

      The page title to attach to this page ping

    • referrer: string

      URL users came from

    • minXOffset: number

      Minimum page x offset seen in the last ping period

    • maxXOffset: number

      Maximum page x offset seen in the last ping period

    • minYOffset: number

      Minimum page y offset seen in the last ping period

    • maxYOffset: number

      Maximum page y offset seen in the last ping period

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackPageView

  • trackPageView(pageUrl: string, pageTitle: string, referrer: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Log the page view / visit

    Parameters

    • pageUrl: string

      Current page URL

    • pageTitle: string

      The user-defined page title to attach to this page view

    • referrer: string

      URL users came from

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackRemoveFromCart

  • trackRemoveFromCart(sku: string, name: string, category: string, unitPrice: string, quantity: string, currency?: undefined | string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a remove-from-cart event

    Parameters

    • sku: string

      Item's SKU code.

    • name: string

      Product name.

    • category: string

      Product category.

    • unitPrice: string

      Product price.

    • quantity: string

      Quantity removed.

    • Optional currency: undefined | string

      Product price currency.

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackScreenView

  • trackScreenView(name: string, id: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a screen view unstructured event

    Parameters

    • name: string

      The name of the screen

    • id: string

      The ID of the screen

    • Optional context: Array<SelfDescribingJson>

      Contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackSiteSearch

  • trackSiteSearch(terms: Array<string>, filters: Record<string, string | boolean>, totalResults: number, pageResults: number, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track an internal search event

    Parameters

    • terms: Array<string>

      Search terms

    • filters: Record<string, string | boolean>

      Search filters

    • totalResults: number

      Number of results

    • pageResults: number

      Number of results displayed on page

    • Optional context: Array<SelfDescribingJson>

      Context relating to the event.

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

    Returns PayloadData

    Payload

trackSocialInteraction

  • trackSocialInteraction(action: string, network: string, target: string, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a social event

    Parameters

    • action: string

      Social action performed

    • network: string

      Social network

    • target: string

      Object of the social action e.g. the video liked, the tweet retweeted

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

trackStructEvent

  • trackStructEvent(category: string, action: string, label: string, property: string, value?: undefined | number, context?: Array<SelfDescribingJson>, tstamp?: Timestamp, afterTrack?: undefined | ((Payload: PayloadDictionary) => void)): PayloadData
  • Track a structured event

    Parameters

    • category: string

      The name you supply for the group of objects you want to track

    • action: string

      A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object

    • label: string

      An optional string to provide additional dimensions to the event data

    • property: string

      Describes the object or the action performed on it, e.g. quantity of item added to basket

    • Optional value: undefined | number

      An integer that you can use to provide numerical data about the user event

    • Optional context: Array<SelfDescribingJson>

      Custom contexts relating to the event

    • Optional tstamp: Timestamp

      Timestamp of the event

    • Optional afterTrack: undefined | ((Payload: PayloadDictionary) => void)

      A callback function triggered after event is tracked

    Returns PayloadData

    Payload

Generated using TypeDoc