Search


Search something to see results

IRumController

Controlling entity for all tracking data collection and sending.

interface IRumController {
    append: (key: string, data: TrackingData, immediately?: boolean) => void;
    calculateRelative: (timer: number) => number;
    getBeaconIndex: () => number;
    getCurrentRumImpression: () => RumImpression;
    getHardNavigation: () => RumImpression;
    getImpressionById: (id: string) => RumImpression;
    getPreviousRumImpression: () => RumImpression;
    getSelector: (el: HTMLElement) => string;
    getTrackedData: () => TrackingObject;
    initRumImpression: (
        baseDimensions: BaseDimensions,
        userData: UserData,
        shouldTrackPI: boolean,
    ) => void;
    onBFCacheNavigation: SimpleTriggerFunction<TrackingData>;
    onClick: SimpleTriggerFunction<TrackingData>;
    onDataLayer: SimpleTriggerFunction<TrackingData>;
    onDataLayerReady: SimpleTriggerFunction<TrackingData>;
    onDfDataReady: SimpleTriggerFunction<TrackingData>;
    onDOMInteractive: SimpleTriggerFunction<TrackingData>;
    onGaReady: SimpleTriggerFunction<TrackingData>;
    onGaTracking: SimpleTriggerFunction<TrackingData>;
    onLeavePage: SimpleTriggerFunction<TrackingData>;
    onLoad: SimpleTriggerFunction<TrackingData>;
    onNextTick: SimpleTriggerFunction<TrackingData>;
    onPiTimeout: SimpleTriggerFunction<TrackingData>;
    onScrollEnd: SimpleTriggerFunction<TrackingData>;
    onSpeedKitLoaded: SimpleTriggerFunction<TrackingData>;
    onVisibilityHidden: SimpleTriggerFunction<TrackingData>;
    set: (
        key: string,
        data: TrackingData,
        immediately?: boolean,
        mode?: boolean | SendMode,
    ) => boolean;
    setTiming: (
        key: string,
        data: TrackingData,
        immediately?: boolean,
        mode?: boolean | SendMode,
    ) => boolean;
    trackCustomEvent: (
        action: string,
        label: string,
        value: number,
        immediately?: boolean,
        withTimestamp?: boolean,
    ) => void;
    trackCustomTimer: (
        key: string,
        data: TrackingData,
        immediately?: boolean,
    ) => void;
    triggerSoftNavigation: (
        url: string,
        timestamp?: number,
        softResourcesDuration?: number,
        softRenderDuration?: number,
    ) => void;
}

Hierarchy (View Summary)

Index

Properties

Properties

append: (key: string, data: TrackingData, immediately?: boolean) => void

Appends the given data to the given key for tracking. This method can be called multiple times to add multiple data items to the key.

calculateRelative: (timer: number) => number

Calculates a given timer relative to the navigation start.

getBeaconIndex: () => number

Returns the current beacon index or 0 if no beacon has been sent yet.

getCurrentRumImpression: () => RumImpression

Returns the pointer to the current page impression.

getHardNavigation: () => RumImpression

Returns the pointer to hard navigation page impression.

getImpressionById: (id: string) => RumImpression

Returns the pointer to the page impression of the given pi id.

getPreviousRumImpression: () => RumImpression

Returns the pointer to the previous page impression.

getSelector: (el: HTMLElement) => string

Returns an accurate selector for an element in the DOM.

getTrackedData: () => TrackingObject

Public method to get the current tracked RUM data

initRumImpression: (
    baseDimensions: BaseDimensions,
    userData: UserData,
    shouldTrackPI: boolean,
) => void

Initializes a new page impression after soft navigation.

onBFCacheNavigation: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after bfCache.

onClick: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after a click event.

The callback function will be called with ClickTriggerEvent and ClickTriggerTarget as parameter.

onDataLayer: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when there is a new data layer event.

The callback function will be called with the data layer event as parameter.

onDataLayerReady: SimpleTriggerFunction<TrackingData>

This method can be used to subscribe to any new populated dataLayer on the window object.

Note that subscribed observers can be notified multiple times on the same page, when the dataLayer is overwritten by a new one. The callback function will be called with the current dataLayer instance as parameter.

onDfDataReady: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after the dynamic fetcher has relevant data.

onDOMInteractive: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after the DOMContentLoaded event.

onGaReady: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when the GA is ready.

onGaTracking: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when the GA tracks an event.

The callback function will be called with the data layer event as parameter.

onLeavePage: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when the user leaves the page.

onLoad: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when the document is completed.

onNextTick: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed in next JS-Tick (end of actual event queue).

onPiTimeout: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed on pi timeout, 29 min after the first beacon.

onScrollEnd: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed when the user scrolls and stops scrolling for 150ms.

onSpeedKitLoaded: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after the dynamic fetcher is done.

onVisibilityHidden: SimpleTriggerFunction<TrackingData>

Ensures the callback is executed after the visibility state changes to hidden.

set: (
    key: string,
    data: TrackingData,
    immediately?: boolean,
    mode?: boolean | SendMode,
) => boolean

Sets the given data to the given key for tracking. Calling this method multiple times will override old value. To track multiple values per key use append

Type Declaration

    • (
          key: string,
          data: TrackingData,
          immediately?: boolean,
          mode?: boolean | SendMode,
      ): boolean
    • Parameters

      • key: string
      • data: TrackingData
      • Optionalimmediately: boolean
      • Optionalmode: boolean | SendMode

      Returns boolean

      true if value is scheduled to be sent with the next beacons, false otherwise.

setTiming: (
    key: string,
    data: TrackingData,
    immediately?: boolean,
    mode?: boolean | SendMode,
) => boolean

Sets the given data to the given key for tracking relatively to the navigationStart when it is numeric. Otherwise it will be tracked normal. Calling this method multiple times will override old value. To track multiple values (without being calculated relatively) per key use append.

Type Declaration

    • (
          key: string,
          data: TrackingData,
          immediately?: boolean,
          mode?: boolean | SendMode,
      ): boolean
    • Parameters

      • key: string
      • data: TrackingData
      • Optionalimmediately: boolean
      • Optionalmode: boolean | SendMode

      Returns boolean

      true if value is scheduled to be sent with the next beacons, false otherwise.

trackCustomEvent: (
    action: string,
    label: string,
    value: number,
    immediately?: boolean,
    withTimestamp?: boolean,
) => void

Send custom event information (action, label and value) using a beacon.

trackCustomTimer: (
    key: string,
    data: TrackingData,
    immediately?: boolean,
) => void

Sends custom timer information (key and data) using a beacon.

triggerSoftNavigation: (
    url: string,
    timestamp?: number,
    softResourcesDuration?: number,
    softRenderDuration?: number,
) => void

Soft navigations can trigger this function to execute callbacks associated to page lifecycle.