Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@exodus/analytics
Advanced tools
A base class encapsulating analytics integration.
Property name | Description |
---|---|
setPermanentUserId | Use this to set the permanent user id, i.e. the seed derived id fetched from analyticsUserIdAtom |
flush | Use this to send persisted events to segment. Events that are track ed before setPermanentUserId is set will need to be flushed |
getAnonymousId | Gets the anonymousId associated with the tracker. This is a UUID until setPermanentUserId is called with the userId |
track | Use this method to send events to segment. If setPermanentUserId has not been called, you must use force: true . |
identify | Used primarily to identify a user with the onboarding UUID and to set global "traits". Should be used sparingly -- on seed import or seed create for example. |
setDefaultProperties | Pretty much as it sounds. This sets persistent properties to be sent with every call to segment via track |
trackInstall | sets a persisted event that can be sent with flush postinstall |
import createStorage from '@exodus/storage-memory' // use the relevant platform-specific implementation
import analyticsDefinition from '@exodus/analytics'
import Tracker from '@exodus/segment-metrics'
const analytics = analyticsDefinition.factory({
storage: storage.namespace('analytics'),
shareActivityAtom,
tracker: new Tracker(segmentApiKey),
// optional
config: {
installEventReportingUrl,
},
logger,
})
/*
* during onboarding, we don't need to set the permanent user id
* segment + analytics will automatically generate a UUID to track onboarding
* so that we can call .track({ event, properties }) without first being
* "connected" or having .setPermanentUserId()
*
* using force: true, you can send the event right away associated w/ the UUID
* force: false (default) will simply persist the event until you call .flush()
*/
analytics.track({ ...onboardingEvent, force: true }) // we can use force: true to send the event to segment
analytics.track({ ...anotherEvent }) // without force: true, this event is persisted and can be sent by using .flush()
const userId = await analyticsUserIdAtom.get() // should come from the IOC container
analytics.setPermanentUserId(userId)
analytics.flush() // any persisted event can now be sent
analytics.track({
event: 'hello world',
})
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. |
trackUnvalidated | no | A boolean flag indicating if not validated events should be still submitted to Segment API. false by default |
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[]>
}
FAQs
Analytics-provider agnostic analytics reporter
We found that @exodus/analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.