Skip to main content

AnalyticsBrowser.load(settings, options?)

Initialize the analytics instance. Settings
KeyTypeRequiredDescription
writeKeystringYesYour Zixflow write key
cdnURLstringNoOverride CDN base URL
cdnSettingsobjectNoSkip remote settings fetch
pluginsPlugin[]NoPlugins to register at load
timeoutnumberNoDispatch timeout (default 300)
Init options — see Advanced Configuration. Returns: AnalyticsBrowser (buffered instance that resolves to Analytics)

analytics.identify(userId?, traits?, options?, callback?)

Identify a user. Returns Promise<Context>.

analytics.track(event, properties?, options?, callback?)

Track an event. Returns Promise<Context>.

analytics.page(category?, name?, properties?, options?, callback?)

Track a page view. Returns Promise<Context>.

analytics.screen(category?, name?, properties?, options?, callback?)

Track a screen view. Returns Promise<Context>.

analytics.group(groupId, traits?, options?, callback?)

Associate the current user with a group. Returns Promise<Context>. Calling analytics.group() with no arguments returns the persisted Group instance.

analytics.alias(to, from?, options?, callback?)

Merge identities. Returns Promise<Context>.

analytics.reset()

Clear user and group identity. Returns Promise<void> / clears persistence.

analytics.ready(callback?)

Run when all plugins are ready. Returns Promise<void>.

analytics.user()

Returns the User instance (id, anonymousId, traits).

analytics.setAnonymousId(id?)

Set (or read) the anonymous ID.

analytics.debug(toggle)

Enable or disable debug logging.

analytics.register(…plugins) / analytics.deregister(…names)

Register or remove plugins.

analytics.addSourceMiddleware(fn)

Add source middleware for all events.

analytics.addDestinationMiddleware(integrationName, …fns)

Add middleware for a specific destination.

subscribeToPush(analytics, options?) / unsubscribeFromPush(analytics, options?)

Web Push helpers exported from @zixflow/analytics-browser. See Web Push Notifications.

analytics.inbox(…topics?)

Returns the inbox API when the in-app plugin is loaded. See In-App Messaging.