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.
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.
Importimport { AnalyticsManager } from 'progressive-web-sdk/dist/analytics-integrations/analytics-manager
Implements:
Constructor
Usagenew AnalyticsManager(options)
Parameter | Type | Description |
---|---|---|
options | Object | Analytics Manager options |
options.connectors | Array.<AnalyticsConnector> | An array of Connectors to register with the Analytics Manager. These must implement the AnalyticsConnector interface. |
options.debug | Boolean | debug 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
Parameter | Type |
---|---|
pageLoad | Object |
pageLoad.start | Number |
pageLoad.end | Number |
load()
Loads necessary resources and performs any additional set up required to create the connection to the Analytics Provider.
Implements:
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.
Implements:
Returns:
Object - The data that was sent to the analytics provider.
See also: types
Parameter | Type | Description |
---|---|---|
type | String | The event type, which can be any String, but Mobify has special support for some built-in types. |
data | Object | The event data, which can be any Object, but Mobify has special support for some built-in types. |