Skip to main content

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​

NameTypeDescriptionRequiredDefault
projectTokenstringMixpanel project token.true
apiSecretstringMixpanel project secret.true
apiRegionstringLearn about EU data residencyfalseUS πŸ‡ΊπŸ‡Έ
sourceNamestringThis value, if it's not blank, will be sent as syft_source_name to Mixpanel for every event/page/screen call.false
strictModestringThis 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 APIfalse1

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 FieldTypeDescriptionSource Field
eventstringThe name of the action being performed.$.event
distinct_idstringA distinct ID specified by you.$.userId ?? $.anonymousId
anonymous_idstringA distinct ID randomly generated prior to calling identify.$.anonymousId
user_idstringThe distinct ID after calling identify.$.userId
group_idstringThe unique identifier of the group that performed this event.$.context.groupId
insert_idstringA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
timedatetimeThe 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_namestringThe name of your application.$.context.app.name
app_namespacestringThe namespace of your application.$.context.app.namespace
app_buildstringThe current build of your application.$.context.app.build
app_versionstringThe current version of your application.$.context.app.version
os_namestringThe name of the mobile operating system or browser that the user is using.$.context.os.name
os_versionstringThe version of the mobile operating system or browser the user is using.$.context.os.version
device_idstringA unique identifier for the device the user is using.$.context.device.id
device_typestringThe type of the user's device.$.context.device.type
device_namestringThe name of the user's device.$.context.device.name
device_manufacturerstringThe device manufacturer that the user is using.$.context.device.manufacturer
device_modelstringThe device model that the user is using.$.context.device.model
bluetoothbooleanWhether bluetooth is enabled.$.context.network.bluetooth
carrierstringThe carrier that the user is using.$.context.network.carrier
cellularbooleanWhether cellular is enabled.$.context.network.cellular
wifibooleanSet to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
countrystringThe current country of the user.$.context.location.country
regionstringThe current region of the user.$.context.location.region
languagestringThe language set by the user.$.context.locale
library_namestringThe name of the SDK used to send events.$.context.library.name
library_versionstringThe version of the SDK used to send events.$.context.library.version
ipstringThe IP address of the user. This is only used for geolocation and won't be stored.$.context.ip
idfastringIdentifier for Advertiser. (iOS)$.context.device.advertisingId ?? $.context.device.idfa
urlstringThe full URL of the webpage on which the event is triggered.$.context.page.url
screen_widthnumberWidth, in pixels, of the device screen.$.context.screen.density
screen_heightnumberHeight, in pixels, of the device screen.$.context.screen.density
screen_densitynumberPixel density of the device screen.$.context.screen.density
referrerstringReferrer url$.context.page.referrer
userAgentstringUser agent$.context.userAgent
advertising_idstringAdvertising ID$.context.device.advertisingId
ad_tracking_enabledstringAd Tracking Enabled (true or false)$.context.device.adTrackingEnabled
timezonestringThe event timezone$.context.timezone
app_platformstringThe App Platform, if applicable$.context.app.platform
namestringThe Event Original Name, if applicable$.event ?? $.name
event_propertiesobjectAn object of key-value pairs that represent additional data to be sent along with the event.$.properties
contextobjectAn object of key-value pairs that provides useful context about the event.$.context
utm_propertiesobjectUTM Tracking Properties
{
"utm_source": {
"@path": "$.context.campaign.source"
},
"utm_medium": {
"@path": "$.context.campaign.medium"
},
"utm_campaign": {
"@path": "$.context.campaign.name"
},
"utm_term": {
"@path": "$.context.campaign.term"
},
"utm_content": {
"@path": "$.context.campaign.content"
}
}
enable_batchingbooleanSet 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 FieldTypeDescriptionSource Field
generatePurchaseEventPerProductbooleanWhen enabled, send "Product Purchased" with each product within the event.true
distinct_idstringA distinct ID specified by you.$.userId ?? $.anonymousId
anonymous_idstringA distinct ID randomly generated prior to calling identify.$.anonymousId
user_idstringThe distinct ID after calling identify.$.userId
group_idstringThe unique identifier of the group that performed this event.$.context.groupId
insert_idstringA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
timedatetimeThe 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_namestringThe name of your application.$.context.app.name
app_namespacestringThe namespace of your application.$.context.app.namespace
app_buildstringThe current build of your application.$.context.app.build
app_versionstringThe current version of your application.$.context.app.version
os_namestringThe name of the mobile operating system or browser that the user is using.$.context.os.name
os_versionstringThe version of the mobile operating system or browser the user is using.$.context.os.version
device_idstringA unique identifier for the device the user is using.$.context.device.id
device_typestringThe type of the user's device.$.context.device.type
device_namestringThe name of the user's device.$.context.device.name
device_manufacturerstringThe device manufacturer that the user is using.$.context.device.manufacturer
device_modelstringThe device model that the user is using.$.context.device.model
bluetoothbooleanWhether bluetooth is enabled.$.context.network.bluetooth
carrierstringThe carrier that the user is using.$.context.network.carrier
cellularbooleanWhether cellular is enabled.$.context.network.cellular
wifibooleanSet to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
countrystringThe current country of the user.$.context.location.country
regionstringThe current region of the user.$.context.location.region
languagestringThe language set by the user.$.context.locale
library_namestringThe name of the SDK used to send events.$.context.library.name
library_versionstringThe version of the SDK used to send events.$.context.library.version
ipstringThe IP address of the user. This is only used for geolocation and won't be stored.$.context.ip
idfastringIdentifier for Advertiser. (iOS)$.context.device.advertisingId ?? $.context.device.idfa
urlstringThe full URL of the webpage on which the event is triggered.$.context.page.url
screen_widthnumberWidth, in pixels, of the device screen.$.context.screen.density
screen_heightnumberHeight, in pixels, of the device screen.$.context.screen.density
screen_densitynumberPixel density of the device screen.$.context.screen.density
referrerstringReferrer url$.context.page.referrer
userAgentstringUser agent$.context.userAgent
advertising_idstringAdvertising ID$.context.device.advertisingId
ad_tracking_enabledstringAd Tracking Enabled (true or false)$.context.device.adTrackingEnabled
timezonestringThe event timezone$.context.timezone
app_platformstringThe App Platform, if applicable$.context.app.platform
namestringThe Event Original Name, if applicable$.event ?? $.name
event_propertiesobjectAn object of key-value pairs that represent additional data to be sent along with the event.$.properties
contextobjectAn object of key-value pairs that provides useful context about the event.$.context
utm_propertiesobjectUTM Tracking Properties
{
"utm_source": {
"@path": "$.context.campaign.source"
},
"utm_medium": {
"@path": "$.context.campaign.medium"
},
"utm_campaign": {
"@path": "$.context.campaign.name"
},
"utm_term": {
"@path": "$.context.campaign.term"
},
"utm_content": {
"@path": "$.context.campaign.content"
}
}
enable_batchingbooleanSet as true to ensure Syft sends data to Mixpanel in batches.true
productsobjectProducts in the order.
{
"@arrayPath": [
"$.properties.products",
{
"product_id": {
"@path": "product_id"
},
"sku": {
"@path": "sku"
},
"category": {
"@path": "category"
},
"name": {
"@path": "name"
},
"brand": {
"@path": "brand"
},
"variant": {
"@path": "variant"
},
"price": {
"@path": "price"
},
"quantity": {
"@path": "quantity"
},
"coupon": {
"@path": "coupon"
},
"position": {
"@path": "position"
},
"url": {
"@path": "url"
},
"image_url": {
"@path": "image_url"
}
}
]
}
eventstringThe 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 FieldTypeDescriptionSource Field
eventstringThe name of the action being performed."Viewed $.name"
distinct_idstringA distinct ID specified by you.$.userId ?? $.anonymousId
anonymous_idstringA distinct ID randomly generated prior to calling identify.$.anonymousId
user_idstringThe distinct ID after calling identify.$.userId
group_idstringThe unique identifier of the group that performed this event.$.context.groupId
insert_idstringA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
timedatetimeThe 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_namestringThe name of your application.$.context.app.name
app_namespacestringThe namespace of your application.$.context.app.namespace
app_buildstringThe current build of your application.$.context.app.build
app_versionstringThe current version of your application.$.context.app.version
os_namestringThe name of the mobile operating system or browser that the user is using.$.context.os.name
os_versionstringThe version of the mobile operating system or browser the user is using.$.context.os.version
device_idstringA unique identifier for the device the user is using.$.context.device.id
device_typestringThe type of the user's device.$.context.device.type
device_namestringThe name of the user's device.$.context.device.name
device_manufacturerstringThe device manufacturer that the user is using.$.context.device.manufacturer
device_modelstringThe device model that the user is using.$.context.device.model
bluetoothbooleanWhether bluetooth is enabled.$.context.network.bluetooth
carrierstringThe carrier that the user is using.$.context.network.carrier
cellularbooleanWhether cellular is enabled.$.context.network.cellular
wifibooleanSet to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
countrystringThe current country of the user.$.context.location.country
regionstringThe current region of the user.$.context.location.region
languagestringThe language set by the user.$.context.locale
library_namestringThe name of the SDK used to send events.$.context.library.name
library_versionstringThe version of the SDK used to send events.$.context.library.version
ipstringThe IP address of the user. This is only used for geolocation and won't be stored.$.context.ip
idfastringIdentifier for Advertiser. (iOS)$.context.device.advertisingId ?? $.context.device.idfa
urlstringThe full URL of the webpage on which the event is triggered.$.context.page.url
screen_widthnumberWidth, in pixels, of the device screen.$.context.screen.density
screen_heightnumberHeight, in pixels, of the device screen.$.context.screen.density
screen_densitynumberPixel density of the device screen.$.context.screen.density
referrerstringReferrer url$.context.page.referrer
userAgentstringUser agent$.context.userAgent
advertising_idstringAdvertising ID$.context.device.advertisingId
ad_tracking_enabledstringAd Tracking Enabled (true or false)$.context.device.adTrackingEnabled
timezonestringThe event timezone$.context.timezone
app_platformstringThe App Platform, if applicable$.context.app.platform
namestringThe Event Original Name, if applicable$.event ?? $.name
event_propertiesobjectAn object of key-value pairs that represent additional data to be sent along with the event.$.properties
contextobjectAn object of key-value pairs that provides useful context about the event.$.context
utm_propertiesobjectUTM Tracking Properties
{
"utm_source": {
"@path": "$.context.campaign.source"
},
"utm_medium": {
"@path": "$.context.campaign.medium"
},
"utm_campaign": {
"@path": "$.context.campaign.name"
},
"utm_term": {
"@path": "$.context.campaign.term"
},
"utm_content": {
"@path": "$.context.campaign.content"
}
}
enable_batchingbooleanSet 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 FieldTypeDescriptionSource Field
eventstringThe name of the action being performed."Viewed $.name"
distinct_idstringA distinct ID specified by you.$.userId ?? $.anonymousId
anonymous_idstringA distinct ID randomly generated prior to calling identify.$.anonymousId
user_idstringThe distinct ID after calling identify.$.userId
group_idstringThe unique identifier of the group that performed this event.$.context.groupId
insert_idstringA random id that is unique to an event. Mixpanel uses $insert_id to deduplicate events.$.messageId
timedatetimeThe 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_namestringThe name of your application.$.context.app.name
app_namespacestringThe namespace of your application.$.context.app.namespace
app_buildstringThe current build of your application.$.context.app.build
app_versionstringThe current version of your application.$.context.app.version
os_namestringThe name of the mobile operating system or browser that the user is using.$.context.os.name
os_versionstringThe version of the mobile operating system or browser the user is using.$.context.os.version
device_idstringA unique identifier for the device the user is using.$.context.device.id
device_typestringThe type of the user's device.$.context.device.type
device_namestringThe name of the user's device.$.context.device.name
device_manufacturerstringThe device manufacturer that the user is using.$.context.device.manufacturer
device_modelstringThe device model that the user is using.$.context.device.model
bluetoothbooleanWhether bluetooth is enabled.$.context.network.bluetooth
carrierstringThe carrier that the user is using.$.context.network.carrier
cellularbooleanWhether cellular is enabled.$.context.network.cellular
wifibooleanSet to true if user’s device has an active, available Wifi connection, false if not.$.context.network.wifi
countrystringThe current country of the user.$.context.location.country
regionstringThe current region of the user.$.context.location.region
languagestringThe language set by the user.$.context.locale
library_namestringThe name of the SDK used to send events.$.context.library.name
library_versionstringThe version of the SDK used to send events.$.context.library.version
ipstringThe IP address of the user. This is only used for geolocation and won't be stored.$.context.ip
idfastringIdentifier for Advertiser. (iOS)$.context.device.advertisingId ?? $.context.device.idfa
urlstringThe full URL of the webpage on which the event is triggered.$.context.page.url
screen_widthnumberWidth, in pixels, of the device screen.$.context.screen.density
screen_heightnumberHeight, in pixels, of the device screen.$.context.screen.density
screen_densitynumberPixel density of the device screen.$.context.screen.density
referrerstringReferrer url$.context.page.referrer
userAgentstringUser agent$.context.userAgent
advertising_idstringAdvertising ID$.context.device.advertisingId
ad_tracking_enabledstringAd Tracking Enabled (true or false)$.context.device.adTrackingEnabled
timezonestringThe event timezone$.context.timezone
app_platformstringThe App Platform, if applicable$.context.app.platform
namestringThe Event Original Name, if applicable$.event ?? $.name
event_propertiesobjectAn object of key-value pairs that represent additional data to be sent along with the event.$.properties
contextobjectAn object of key-value pairs that provides useful context about the event.$.context
utm_propertiesobjectUTM Tracking Properties
{
"utm_source": {
"@path": "$.context.campaign.source"
},
"utm_medium": {
"@path": "$.context.campaign.medium"
},
"utm_campaign": {
"@path": "$.context.campaign.name"
},
"utm_term": {
"@path": "$.context.campaign.term"
},
"utm_content": {
"@path": "$.context.campaign.content"
}
}
enable_batchingbooleanSet 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 FieldTypeDescriptionSource Field
ipstringThe IP address of the user. This is only used for geolocation and won't be stored.$.context.ip
user_idstringThe unique user identifier set by you$.userId
anonymous_idstringThe generated anonymous ID for the user$.anonymousId
traitsobjectProperties 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 FieldTypeDescriptionSource Field
group_keystringThe group key you specified in Mixpanel under Project settings. If this is not specified, it will be defaulted to "$group_id".$.group_key
group_idstringThe unique identifier of the group. If there is a trait that matches the group key, it will override this value.$.groupId
traitsobjectThe properties to set on the group profile.$.traits