menu
Menu
Mobify DevCenter
search_icon_focus

Google Analytics

progressive-web-sdk/dist/analytics-integrations/connectors/google-analytics

The google-analytics module contains the GoogleAnalyticsConnector class, an implementation of the AnalyticsConnector interface, used for connecting to Google Analytics.

class

GoogleAnalyticsConnector

Import
import { GoogleAnalyticsConnector } from 'progressive-web-sdk/dist/analytics-integrations/connectors/google-analytics

Implements:

AnalyticsConnector

Constructor

Usage
new GoogleAnalyticsConnector(options)
ParameterTypeDescription
optionsObjectGoogle Analytics options.
options.trackerNameString(required) Google Analytics Tracker name.
options.trackerIdString(required) Google Analytics Tracker id.
options.splitTestConfigObjectconfiguration values required to set up split test: clientIdDimension, bucketDimension, bucketValue.
options.ecommerceLibraryStringThe name of the Google Analytics ecommerce library to load.
options.gaDebugBoolean(default: false) GA debug flag. true will load the ga library that enables debugging.

Methods

setupSplitTest()

Spit test set up.

Returns:

undefined


loadEcommerceLibrary()

Ecommerce library initialization.

Returns:

undefined


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.