Methods Reference
id#
id: (userData: UserProps, doNotSendEvent?: boolean) => Promise
Sets a user data.
| Param | Type | Description |
|---|---|---|
| userData | UserProps | user data |
| doNotSendEvent? | boolean | if true (false by default), separate "id" event won't be sent to server |
track#
track: (typeName: string, payload?: EventPayload) => Promise
Sends a track event to server.
| Param | Type | Description |
|---|---|---|
| typeName | string | event name |
| payload? | EventPayload | event payload |
rawTrack#
rawTrack: (payload: any) => Promise
Similar to track, but send unstructured payload to EventNative processing pipeline.
No additional detection (user-agent, url and so on will be done). No payload structure is enforced.
| Param | Type | Description |
|---|---|---|
| payload | any | event payload |
set#
set(properties: Record<string, any>, opts?: { eventType?: string, persist?: boolean })
Sets a permanent properties that will be persisted across sessions. On every track() call those properties will be merged with payload parameter
| Param | Type | Description |
|---|---|---|
| properties | Record<string, any> | set properties |
| opts | { eventType?: string, persist?: boolean } | eventType - apply permanent properties to only certain event type (applied to all types by default)persist - persist properties across sessions (in cookies). True by default |
unset#
unset(propertyName: string, opts: { eventType?: string, persist?: boolean })
Unsets a permanent properties added with set()
| Param | Type | Description |
|---|---|---|
| propertyName | string | property to unset |
| opts | { eventType?: string, persist?: boolean } | eventType - apply permanent properties to only certain event type (applied to all types by default)persist - persist properties across sessions (in cookies). True by default |
interceptAnalytics#
interceptAnalytics: (analytics: any) => void
Explicit call for intercepting Segment's analytics.
| Param | Type | Description |
|---|---|---|
| analytics | any | window.analytics object |