@reactor/analytics — reactoranalytics
@reactor/analytics / ReactorAnalytics
Class: ReactorAnalytics
Section titled “Class: ReactorAnalytics”Defined in: index.ts:188
Reactor Analytics client.
Provides methods for tracking events, identifying users, and managing consent.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ReactorAnalytics(
config):ReactorAnalytics
Defined in: index.ts:198
Parameters
Section titled “Parameters”config
Section titled “config”Returns
Section titled “Returns”ReactorAnalytics
Methods
Section titled “Methods”alias()
Section titled “alias()”alias(
previousId,userId):void
Defined in: index.ts:312
Alias an anonymous ID to a user ID.
Parameters
Section titled “Parameters”previousId
Section titled “previousId”string
Previous anonymous ID.
userId
Section titled “userId”string
User ID to alias to.
Returns
Section titled “Returns”void
flush()
Section titled “flush()”flush():
Promise<void>
Defined in: index.ts:348
Flush the event queue.
Returns
Section titled “Returns”Promise<void>
getAnonymousId()
Section titled “getAnonymousId()”getAnonymousId():
string
Defined in: index.ts:393
Get the current anonymous ID.
Returns
Section titled “Returns”string
getSessionId()
Section titled “getSessionId()”getSessionId():
string
Defined in: index.ts:407
Get the current session ID.
Returns
Section titled “Returns”string
getUserId()
Section titled “getUserId()”getUserId():
string|undefined
Defined in: index.ts:400
Get the current user ID.
Returns
Section titled “Returns”string | undefined
identify()
Section titled “identify()”identify(
userId,traits?):void
Defined in: index.ts:284
Identify a user.
Parameters
Section titled “Parameters”userId
Section titled “userId”string
User ID.
traits?
Section titled “traits?”UserTraits = {}
User traits (email, name, etc.).
Returns
Section titled “Returns”void
optIn()
Section titled “optIn()”optIn():
void
Defined in: index.ts:385
Opt in to tracking.
Returns
Section titled “Returns”void
optOut()
Section titled “optOut()”optOut():
void
Defined in: index.ts:376
Opt out of tracking.
Returns
Section titled “Returns”void
page()
Section titled “page()”page(
name?,properties?):void
Defined in: index.ts:267
Track a page view.
Parameters
Section titled “Parameters”string
Page name (optional).
properties?
Section titled “properties?”EventProperties = {}
Additional properties.
Returns
Section titled “Returns”void
reset()
Section titled “reset()”reset():
void
Defined in: index.ts:335
Reset the user identity. Generates a new anonymous ID and clears the user ID.
Returns
Section titled “Returns”void
track()
Section titled “track()”track(
event,properties?):void
Defined in: index.ts:245
Track an event.
Parameters
Section titled “Parameters”string
Event name.
properties?
Section titled “properties?”EventProperties = {}
Event properties.
Returns
Section titled “Returns”void