analytics-integrations/analytics-manager.AnalyticsManager(options)

The main entry point to Mobify's analytics framework. You can use this class to send analytics data to several analytics connectors at the same time.

This class is a composite - when you call track('event', {payload}) on the AnalyticsManager, it will call the track() method on every configured Connector, in turn.

Constructor

new AnalyticsManager(options)

Parameters:
Name Type Description
options Object

Analytics Manager options

Properties
Name Type Description
connectors Array.<AnalyticsConnector>

An array of Connectors to register with the Analytics Manager. These must implement the AnalyticsConnector interface.

debug Boolean

debug mode flag. true will turn the logger on.

Implements:

Methods

load() → {Promise.<undefined>}

Loads necessary resources and performs any additional set up required to create the connection to the Analytics Provider.

Implements:
See:
Returns:

Returns a resolved promise when the resources are fully loaded.

Type
Promise.<undefined>

track()

Validate and transform the analytics event and send it to its analytics connectors.

Implements:
Examples
// Tracking a page view event
track('pageview', {templateName: 'home'})

// Tracking an offline mode event
track('offline', {startTime: 123})

// Tracking a UI interaction event.
// Mobify does not expect end-users to implement UI interactions, as it is already being tracked.
track('uiInteraction', {
            subject: 'user',
            name: 'swatch:color',
            action: 'focus',
            object: 'button',
            content: 'grey'
        })

// Tracking a pageview event
// Mobify does not expect end-users to implement performance events, as this already being tracked.
track('performance', {
            bundle: 'production',
            page_start: 123,
            timing_start: 123,
            mobify_start: 123,
            app_start: 123,
            page_paint: 123,
            full_page_load: 123,
            first_paint: 123,
            first_contentful_paint: 123,
            time_to_interactive: 123
        })

trackPageLoad(initPagePromise) → {Promise}

Record performance metrics from initializing a page.

Parameters:
Name Type Description
initPagePromise Promise

The promise that initializes a page.

Returns:

The response from an initialized page.

Type
Promise