Exodus analytics
A base class encapsulating analytics integration.
Usage
import createStorage from '@exodus/storage-memory'
import analyticsDefinition from '@exodus/analytics'
import Tracker from '@exodus/segment-metrics'
const analytics = analyticsDefinition.factory({
storage: storage.namespace('analytics'),
shareActivityAtom,
tracker: new Tracker(segmentApiKey),
config: {
installEventReportingUrl,
},
logger,
})
analytics.connect('the-dummiest-anonymous-id')
analytics.track({
event: 'hello world',
})
API reference
Property name | Required | Description |
---|
tracker | yes | A Tracker class instance. |
storage | yes | An object implementing the Storage interface (see below). Needed if you need to persist events (e.g. when a consumer application can be temporarily locked). |
shareActivityAtom | yes | An atom returning a boolean value indicating if a consumer application is ready to send events. |
config | no | Static configuration options |
config.installEventReportingUrl | no | Url to which to post app install events |
type SerializedEvent = 'string'
interface Storage {
set: (key: string, events: SerializedEvent[]) => Promise<undefined>
get: (key: string) => Promise<SerializedEvent[]>
}