Mixpanel
This page describes how to set up Mixpanel as a destination.
Set upβ
An example setup for Mixpanel is shown below.
src/pages/api/syft.ts
// ...
const destinations = [
{
type: "mixpanel",
settings: {
projectToken: "xxxx",
apiSecret: "xxxx"
},
},
];
// ...
Configuration optionsβ
Name | Type | Description | Required | Default |
---|---|---|---|---|
projectToken | string | Mixpanel project token. | true | |
apiSecret | string | Mixpanel project secret. | true | |
apiRegion | string | Learn about EU data residency | false | US πΊπΈ |
sourceName | string | This value, if it's not blank, will be sent as syft_source_name to Mixpanel for every event/page/screen call. | false | |
strictMode | string | This value, if it's 1 (recommended), Mixpanel will validate the events you are trying to send and return errors per event that failed. Learn more about the Mixpanel Import Events API | false | 1 |
Data Modelingβ
Track Calls
Track Eventβ
Send an event to Mixpanel. Learn more about Events in Mixpanel
Matched eventsβ
type = "track" and event != "Order Completed"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
event | string | The name of the action being performed. | $.event |
distinct_id | string | A distinct ID specified by you. | $.userId ?? $.anonymousId |
anonymous_id | string | A distinct ID randomly generated prior to calling identify. | $.anonymousId |
user_id | string | The distinct ID after calling identify. | $.userId |
group_id | string | The unique identifier of the group that performed this event. | $.context.groupId |
insert_id | string | A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. | $.messageId |
time | datetime | The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it. | $.timestamp |
app_name | string | The name of your application. | $.context.app.name |
app_namespace | string | The namespace of your application. | $.context.app.namespace |
app_build | string | The current build of your application. | $.context.app.build |
app_version | string | The current version of your application. | $.context.app.version |
os_name | string | The name of the mobile operating system or browser that the user is using. | $.context.os.name |
os_version | string | The version of the mobile operating system or browser the user is using. | $.context.os.version |
device_id | string | A unique identifier for the device the user is using. | $.context.device.id |
device_type | string | The type of the user's device. | $.context.device.type |
device_name | string | The name of the user's device. | $.context.device.name |
device_manufacturer | string | The device manufacturer that the user is using. | $.context.device.manufacturer |
device_model | string | The device model that the user is using. | $.context.device.model |
bluetooth | boolean | Whether bluetooth is enabled. | $.context.network.bluetooth |
carrier | string | The carrier that the user is using. | $.context.network.carrier |
cellular | boolean | Whether cellular is enabled. | $.context.network.cellular |
wifi | boolean | Set to true if userβs device has an active, available Wifi connection, false if not. | $.context.network.wifi |
country | string | The current country of the user. | $.context.location.country |
region | string | The current region of the user. | $.context.location.region |
language | string | The language set by the user. | $.context.locale |
library_name | string | The name of the SDK used to send events. | $.context.library.name |
library_version | string | The version of the SDK used to send events. | $.context.library.version |
ip | string | The IP address of the user. This is only used for geolocation and won't be stored. | $.context.ip |
idfa | string | Identifier for Advertiser. (iOS) | $.context.device.advertisingId ?? $.context.device.idfa |
url | string | The full URL of the webpage on which the event is triggered. | $.context.page.url |
screen_width | number | Width, in pixels, of the device screen. | $.context.screen.density |
screen_height | number | Height, in pixels, of the device screen. | $.context.screen.density |
screen_density | number | Pixel density of the device screen. | $.context.screen.density |
referrer | string | Referrer url | $.context.page.referrer |
userAgent | string | User agent | $.context.userAgent |
advertising_id | string | Advertising ID | $.context.device.advertisingId |
ad_tracking_enabled | string | Ad Tracking Enabled (true or false) | $.context.device.adTrackingEnabled |
timezone | string | The event timezone | $.context.timezone |
app_platform | string | The App Platform, if applicable | $.context.app.platform |
name | string | The Event Original Name, if applicable | $.event ?? $.name |
event_properties | object | An object of key-value pairs that represent additional data to be sent along with the event. | $.properties |
context | object | An object of key-value pairs that provides useful context about the event. | $.context |
utm_properties | object | UTM Tracking Properties |
|
enable_batching | boolean | Set as true to ensure Syft sends data to Mixpanel in batches. | true |
Order Completed Calls
Track Purchaseβ
Send an 'Order Completed' Event to Mixpanel.
Matched eventsβ
type = "track" and event = "Order Completed"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
generatePurchaseEventPerProduct | boolean | When enabled, send "Product Purchased" with each product within the event. | true |
distinct_id | string | A distinct ID specified by you. | $.userId ?? $.anonymousId |
anonymous_id | string | A distinct ID randomly generated prior to calling identify. | $.anonymousId |
user_id | string | The distinct ID after calling identify. | $.userId |
group_id | string | The unique identifier of the group that performed this event. | $.context.groupId |
insert_id | string | A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. | $.messageId |
time | datetime | The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it. | $.timestamp |
app_name | string | The name of your application. | $.context.app.name |
app_namespace | string | The namespace of your application. | $.context.app.namespace |
app_build | string | The current build of your application. | $.context.app.build |
app_version | string | The current version of your application. | $.context.app.version |
os_name | string | The name of the mobile operating system or browser that the user is using. | $.context.os.name |
os_version | string | The version of the mobile operating system or browser the user is using. | $.context.os.version |
device_id | string | A unique identifier for the device the user is using. | $.context.device.id |
device_type | string | The type of the user's device. | $.context.device.type |
device_name | string | The name of the user's device. | $.context.device.name |
device_manufacturer | string | The device manufacturer that the user is using. | $.context.device.manufacturer |
device_model | string | The device model that the user is using. | $.context.device.model |
bluetooth | boolean | Whether bluetooth is enabled. | $.context.network.bluetooth |
carrier | string | The carrier that the user is using. | $.context.network.carrier |
cellular | boolean | Whether cellular is enabled. | $.context.network.cellular |
wifi | boolean | Set to true if userβs device has an active, available Wifi connection, false if not. | $.context.network.wifi |
country | string | The current country of the user. | $.context.location.country |
region | string | The current region of the user. | $.context.location.region |
language | string | The language set by the user. | $.context.locale |
library_name | string | The name of the SDK used to send events. | $.context.library.name |
library_version | string | The version of the SDK used to send events. | $.context.library.version |
ip | string | The IP address of the user. This is only used for geolocation and won't be stored. | $.context.ip |
idfa | string | Identifier for Advertiser. (iOS) | $.context.device.advertisingId ?? $.context.device.idfa |
url | string | The full URL of the webpage on which the event is triggered. | $.context.page.url |
screen_width | number | Width, in pixels, of the device screen. | $.context.screen.density |
screen_height | number | Height, in pixels, of the device screen. | $.context.screen.density |
screen_density | number | Pixel density of the device screen. | $.context.screen.density |
referrer | string | Referrer url | $.context.page.referrer |
userAgent | string | User agent | $.context.userAgent |
advertising_id | string | Advertising ID | $.context.device.advertisingId |
ad_tracking_enabled | string | Ad Tracking Enabled (true or false) | $.context.device.adTrackingEnabled |
timezone | string | The event timezone | $.context.timezone |
app_platform | string | The App Platform, if applicable | $.context.app.platform |
name | string | The Event Original Name, if applicable | $.event ?? $.name |
event_properties | object | An object of key-value pairs that represent additional data to be sent along with the event. | $.properties |
context | object | An object of key-value pairs that provides useful context about the event. | $.context |
utm_properties | object | UTM Tracking Properties |
|
enable_batching | boolean | Set as true to ensure Syft sends data to Mixpanel in batches. | true |
products | object | Products in the order. |
|
event | string | The name of the action being performed. | $.event |
Page Calls
Track Eventβ
Send an event to Mixpanel. Learn more about Events in Mixpanel
Matched eventsβ
type = "page"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
event | string | The name of the action being performed. | "Viewed $.name" |
distinct_id | string | A distinct ID specified by you. | $.userId ?? $.anonymousId |
anonymous_id | string | A distinct ID randomly generated prior to calling identify. | $.anonymousId |
user_id | string | The distinct ID after calling identify. | $.userId |
group_id | string | The unique identifier of the group that performed this event. | $.context.groupId |
insert_id | string | A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. | $.messageId |
time | datetime | The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it. | $.timestamp |
app_name | string | The name of your application. | $.context.app.name |
app_namespace | string | The namespace of your application. | $.context.app.namespace |
app_build | string | The current build of your application. | $.context.app.build |
app_version | string | The current version of your application. | $.context.app.version |
os_name | string | The name of the mobile operating system or browser that the user is using. | $.context.os.name |
os_version | string | The version of the mobile operating system or browser the user is using. | $.context.os.version |
device_id | string | A unique identifier for the device the user is using. | $.context.device.id |
device_type | string | The type of the user's device. | $.context.device.type |
device_name | string | The name of the user's device. | $.context.device.name |
device_manufacturer | string | The device manufacturer that the user is using. | $.context.device.manufacturer |
device_model | string | The device model that the user is using. | $.context.device.model |
bluetooth | boolean | Whether bluetooth is enabled. | $.context.network.bluetooth |
carrier | string | The carrier that the user is using. | $.context.network.carrier |
cellular | boolean | Whether cellular is enabled. | $.context.network.cellular |
wifi | boolean | Set to true if userβs device has an active, available Wifi connection, false if not. | $.context.network.wifi |
country | string | The current country of the user. | $.context.location.country |
region | string | The current region of the user. | $.context.location.region |
language | string | The language set by the user. | $.context.locale |
library_name | string | The name of the SDK used to send events. | $.context.library.name |
library_version | string | The version of the SDK used to send events. | $.context.library.version |
ip | string | The IP address of the user. This is only used for geolocation and won't be stored. | $.context.ip |
idfa | string | Identifier for Advertiser. (iOS) | $.context.device.advertisingId ?? $.context.device.idfa |
url | string | The full URL of the webpage on which the event is triggered. | $.context.page.url |
screen_width | number | Width, in pixels, of the device screen. | $.context.screen.density |
screen_height | number | Height, in pixels, of the device screen. | $.context.screen.density |
screen_density | number | Pixel density of the device screen. | $.context.screen.density |
referrer | string | Referrer url | $.context.page.referrer |
userAgent | string | User agent | $.context.userAgent |
advertising_id | string | Advertising ID | $.context.device.advertisingId |
ad_tracking_enabled | string | Ad Tracking Enabled (true or false) | $.context.device.adTrackingEnabled |
timezone | string | The event timezone | $.context.timezone |
app_platform | string | The App Platform, if applicable | $.context.app.platform |
name | string | The Event Original Name, if applicable | $.event ?? $.name |
event_properties | object | An object of key-value pairs that represent additional data to be sent along with the event. | $.properties |
context | object | An object of key-value pairs that provides useful context about the event. | $.context |
utm_properties | object | UTM Tracking Properties |
|
enable_batching | boolean | Set as true to ensure Syft sends data to Mixpanel in batches. | true |
Screen Calls
Track Eventβ
Send an event to Mixpanel. Learn more about Events in Mixpanel
Matched eventsβ
type = "screen"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
event | string | The name of the action being performed. | "Viewed $.name" |
distinct_id | string | A distinct ID specified by you. | $.userId ?? $.anonymousId |
anonymous_id | string | A distinct ID randomly generated prior to calling identify. | $.anonymousId |
user_id | string | The distinct ID after calling identify. | $.userId |
group_id | string | The unique identifier of the group that performed this event. | $.context.groupId |
insert_id | string | A random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events. | $.messageId |
time | datetime | The timestamp of the event. Mixpanel expects epoch timestamp in millisecond or second. Please note, Mixpanel only accepts this field as the timestamp. If the field is empty, it will be set to the time Mixpanel servers receive it. | $.timestamp |
app_name | string | The name of your application. | $.context.app.name |
app_namespace | string | The namespace of your application. | $.context.app.namespace |
app_build | string | The current build of your application. | $.context.app.build |
app_version | string | The current version of your application. | $.context.app.version |
os_name | string | The name of the mobile operating system or browser that the user is using. | $.context.os.name |
os_version | string | The version of the mobile operating system or browser the user is using. | $.context.os.version |
device_id | string | A unique identifier for the device the user is using. | $.context.device.id |
device_type | string | The type of the user's device. | $.context.device.type |
device_name | string | The name of the user's device. | $.context.device.name |
device_manufacturer | string | The device manufacturer that the user is using. | $.context.device.manufacturer |
device_model | string | The device model that the user is using. | $.context.device.model |
bluetooth | boolean | Whether bluetooth is enabled. | $.context.network.bluetooth |
carrier | string | The carrier that the user is using. | $.context.network.carrier |
cellular | boolean | Whether cellular is enabled. | $.context.network.cellular |
wifi | boolean | Set to true if userβs device has an active, available Wifi connection, false if not. | $.context.network.wifi |
country | string | The current country of the user. | $.context.location.country |
region | string | The current region of the user. | $.context.location.region |
language | string | The language set by the user. | $.context.locale |
library_name | string | The name of the SDK used to send events. | $.context.library.name |
library_version | string | The version of the SDK used to send events. | $.context.library.version |
ip | string | The IP address of the user. This is only used for geolocation and won't be stored. | $.context.ip |
idfa | string | Identifier for Advertiser. (iOS) | $.context.device.advertisingId ?? $.context.device.idfa |
url | string | The full URL of the webpage on which the event is triggered. | $.context.page.url |
screen_width | number | Width, in pixels, of the device screen. | $.context.screen.density |
screen_height | number | Height, in pixels, of the device screen. | $.context.screen.density |
screen_density | number | Pixel density of the device screen. | $.context.screen.density |
referrer | string | Referrer url | $.context.page.referrer |
userAgent | string | User agent | $.context.userAgent |
advertising_id | string | Advertising ID | $.context.device.advertisingId |
ad_tracking_enabled | string | Ad Tracking Enabled (true or false) | $.context.device.adTrackingEnabled |
timezone | string | The event timezone | $.context.timezone |
app_platform | string | The App Platform, if applicable | $.context.app.platform |
name | string | The Event Original Name, if applicable | $.event ?? $.name |
event_properties | object | An object of key-value pairs that represent additional data to be sent along with the event. | $.properties |
context | object | An object of key-value pairs that provides useful context about the event. | $.context |
utm_properties | object | UTM Tracking Properties |
|
enable_batching | boolean | Set as true to ensure Syft sends data to Mixpanel in batches. | true |
Identify Calls
Identify Userβ
Set the user ID for a particular device ID or update user properties. Learn more about User Profiles and Identity Management.
Matched eventsβ
type = "identify"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
ip | string | The IP address of the user. This is only used for geolocation and won't be stored. | $.context.ip |
user_id | string | The unique user identifier set by you | $.userId |
anonymous_id | string | The generated anonymous ID for the user | $.anonymousId |
traits | object | Properties to set on the user profile | $.traits |
Group Calls
Group Identify Userβ
Updates or adds properties to a group profile. The profile is created if it does not exist. Learn more about Group Analytics.
Matched eventsβ
type = "group"
Data Mappingβ
Destination Field | Type | Description | Source Field |
---|---|---|---|
group_key | string | The group key you specified in Mixpanel under Project settings. If this is not specified, it will be defaulted to "$group_id". | $.group_key |
group_id | string | The unique identifier of the group. If there is a trait that matches the group key, it will override this value. | $.groupId |
traits | object | The properties to set on the group profile. | $.traits |