menu
Menu
Mobify DevCenter
search_icon_focus

Analytics Manager

progressive-web-sdk/dist/analytics-integrations/analytics-manager

The analytics-manager module contains the AnalyticsManager class, the main entry point to Mobify’s analytics framework. You can use it to send analytics data to several analytics connectors at the same time.

class

AnalyticsManager

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

Import
import { AnalyticsManager } from 'progressive-web-sdk/dist/analytics-integrations/analytics-manager

Implements:

AnalyticsConnector

Constructor

Usage
new AnalyticsManager(options)
ParameterTypeDescription
optionsObjectAnalytics Manager options
options.connectorsArray.<AnalyticsConnector>An array of Connectors to register with the Analytics Manager. These must implement the AnalyticsConnector interface.
options.debugBooleandebug mode flag. true will turn the logger on.

Methods

trackPageLoad(pageLoad)

Track performance metrics for page loads.

If the window.performance API is unavailable, this does nothing.

Returns:

Promise

ParameterType
pageLoadObject
pageLoad.startNumber
pageLoad.endNumber

load()

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

Returns:

Promise.<undefined> - Returns a resolved promise when the resources are fully loaded.

See also: loadScript


track(type, data)

Track an analytics event and send it to an analytics provider.

Returns:

Object - The data that was sent to the analytics provider.

See also: types

ParameterTypeDescription
typeStringThe event type, which can be any String, but Mobify has special support for some built-in types.
dataObjectThe event data, which can be any Object, but Mobify has special support for some built-in types.