JavaScript SDK API Reference
Complete method signature reference for @empmix/sdk-js.
EmpMix.init()
Initializes the SDK. Must be called before any other method.
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your project's Public API key. |
| options | object | No | Configuration options (autoPageView, batchSize, flushInterval, debug, apiHost). |
EmpMix.track()
Queues an event to be sent to Emp-Mix.
| Parameter | Type | Required | Description |
|---|---|---|---|
| eventName | string | Yes | The name of the event. |
| properties | object | No | Optional custom properties for the event. |
EmpMix.identify()
Links the current anonymous device ID to a permanent user ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | The permanent user ID from your database. |
| profile | object | No | Optional properties to immediately set on the user's profile. |
EmpMix.alias()
Aliases the current anonymous ID to a new permanent ID (used during sign up).
| Parameter | Type | Required | Description |
|---|---|---|---|
| newUserId | string | Yes | The newly created permanent user ID. |
EmpMix.setUserProperties()
Updates the currently identified user's profile without sending an event.
| Parameter | Type | Required | Description |
|---|---|---|---|
| properties | object | Yes | A dictionary of key-value pairs to set on the user. |
EmpMix.increment()
Increments a numeric property on the user's profile.
| Parameter | Type | Required | Description |
|---|---|---|---|
| property | string | Yes | The name of the numeric property. |
| amount | number | Yes | The amount to increment by. |
EmpMix.registerSuperProperties()
Registers properties to be sent with every single track call.
| Parameter | Type | Required | Description |
|---|---|---|---|
| properties | object | Yes | A dictionary of properties to attach to all future events. |
EmpMix.reset()
Clears all cookies, localStorage queue, and distinct_ids. Call on logout.
| Parameter | Type | Required | Description |
|---|