Reference Source
public class | source

Tracking

You can directly use an instance of this class. tracking

Signature function used to track the usage of Coral components. By default, there is no out of the box implementation as tracking is agnostic of the underlying technology.

You need to implement a new tracker and add it with: Coral.tracking.addListener(fn(){ });

The fn() callback will receive multiple arguments: trackData - an object with fixed structure e.g. {type: "button", eventType: "click", element: "save settings", feature: "sites"} event - the CustomEvent or MouseEvent details object. component - the component reference object.

Using the above data you can map it to your own analytics tracker.

Constructor Summary

Public Constructor
public

Method Summary

Public Methods
public

addListener(trackingCallback: TrackingCallback)

Add a tracking callback.

public

removeListener(trackingCallback: TrackingCallback)

Removes a tracker.

public

track(eventType: String, targetType: String, event: CustomEvent, component: BaseComponent, childComponent: BaseComponent): Boolean

Notify all trackers subscribed.

Public Constructors

public constructor() source

Public Methods

public addListener(trackingCallback: TrackingCallback) source

Add a tracking callback. This will be invoked every time a tracking event is emitted.

Params:

NameTypeAttributeDescription
trackingCallback TrackingCallback

The callback to execute.

public removeListener(trackingCallback: TrackingCallback) source

Removes a tracker.

Params:

NameTypeAttributeDescription
trackingCallback TrackingCallback

public track(eventType: String, targetType: String, event: CustomEvent, component: BaseComponent, childComponent: BaseComponent): Boolean source

Notify all trackers subscribed.

Params:

NameTypeAttributeDescription
eventType String

Eg. click, select, etc.

targetType String

Eg. cycle button, cycle button item, etc.

event CustomEvent
component BaseComponent
childComponent BaseComponent

Optional, in case the event occurred on a child component.

Return:

Boolean

if the event was dispatch to at least 1 tracker.