Mixpanel
Integrating OneSignal with Mixpanel
Mixpanel and OneSignal have joined forces to provide:
- Personalized messaging - Boost engagement with more contextualized messaging from OneSignal, triggered when users enter or exit Mixpanel cohorts.
- Real-time insights - Gain a holistic view of customers by combining Mixpanel in-product user actions and OneSignal message engagement metrics.
- Data-driven campaigns - Leverage product-level user insights for re-engaging campaigns through OneSignal.
Requirements
- A Mixpanel Account
- Upgraded OneSignal Account is required for this integration.
- The OneSignal Mobile SDK and/or Web SDK from which you want to send data. Email or SMS only integrations do not require the SDK.
- Setting the OneSignal External ID that matches a selected Mixpanel user property.
Setup
1. Turn on Integration
In OneSignal, navigate to Settings > Integrations > Mixpanel and click Activate.
2. Add Mixpanel Token in OneSignal Dashboard
You can find your Mixpanel Token under Project Settings > Access Keys.
Copy-paste the Project Token into OneSignal. See Mixpanel's "Find Project Token" guide for further details.
At this step, you'll also select which OneSignal Events you want to send back to your Mixpanel project. More details on what events are available and the data properties attached to each event.
In your Mixpanel Project Settings > Data Residency, if you see "Data Residency" listed as US, you should leave the "Send events exclusively to Mixpanel EU servers" box unchecked. If it shows EU, then check the box.
3. Add OneSignal to Mixpanel Integrations
In your Mixpanel Integrations dashboard. Select OneSignal and press Connect.
To connect to OneSignal, copy-paste the "App ID" and "REST API Key" from the OneSignal dashboard Settings > Keys & IDs. Copy the "App ID" and the "REST API key".
USER ID PROPERTY
Recommended: The User ID Property section refers to any Mixpanel user property that needs to be the same value as the OneSignal External ID.
In this example, you can see the Mixpanel "User ID" property matches the OneSignal External ID.
Example: Mixpanel User showing "User ID".
Example: OneSignal User records shows matching "External ID".
Note on Distinct ID
If you match users to OneSignal based on the Mixpanel
$distinct_id
then it will only match with the top value.In below example, only
890ea9b1-9024-4fb9-a92f-152ba67dd21a
will work. It cannot match109768518080488203109
or$device:1880c06821f1b3-052354675cde95-1d525634-1fa400-1880c06821f1b3
.
Click Continue when finished.
4. Sync Mixpanel and OneSignal External ID
Syncing user data across OneSignal and Mixpanel requires setting the OneSignal External ID property to a "User ID" property set in Mixpanel.
Unlike Mixpanel which stores email and phone number to a single User Record, OneSignal creates separate Channel Records for push, email and sms. Emails and phone numbers need to be added into OneSignal to receive messages on those channels.
Highly Important
- You must use this option for multi-channel messaging: Push, Email, In-App Messages, and SMS.
- Email Addresses and/or SMS Phone Numbers must be added to OneSignal to receive messages.
- You must select Use external_user_id to sync events (recommended) in step 2.
OneSignal's External ID is user-level identifier that can be associate across different OneSignal Channel Records (Push, Email, In-App Messages, and/or SMS).
The Push/In-App Message Channel Record is created when the user subscribes to push on your website or opens your mobile app with the OneSignal SDK.
5. Moving Current Mixpanel Subscriptions to OneSignal
Optional
You may Import Email Addresses and Import Phone Numbers into OneSignal to immediately message your user base. Using the CSV imports or API allows you to set the external_id
property which must match the "User ID" property in Mixpanel.
Mixpanel User Data Sync
Mixpanel cohorts and analytics will not sync with OneSignal until the Mixpanel property set in your connection matches the OneSignal External ID for the specific channel record you are messaging.
6. Export Mixpanel Cohorts to OneSignal
In Mixpanel Users > Cohorts select the 3-dot option next to the cohort you want to send push.
Select Export to... > OneSignal
Under "Export Type" you have 2 options:
- "One-time export" will send OneSignal the current user data. Best if sending one message only to the current users.
- "Dynamic Sync" is where Mixpanel will send OneSignal the updated cohort data around every 15 minutes. Best if sending recurring messages to updated user list.
Dynamic cohort limits
Mixpanel only allows 60 dynamic cohorts to be synced at a time.
Select the option and press Begin Sync.
- The exported Mixpanel Cohorts will show in the onesignal.com dashboard Audience > Segments as a new segment and will become available as a segment filter for further customization.
OneSignal will also automatically sync the $first_name
and $last_name
user info from Mixpanel user records to our Data Tags if they are present. This is helpful for Message Personalization.
7. Send Messages
See our guides on sending messages based on the channels you use. You can also setup Journeys.
8. Tracking Message Data in Mixpanel
In Mixpanel User Activity Feed, OneSignal Message Events will appear in activity feed like:
- Message Sent
- App Opened from Push (clicked event)
Each event has properties from OneSignal, which can be found in a table below.
Cohort Events
These are the message event kinds that OneSignal sends to Mixpanel. You can select which of these events you want to send to your Mixpanel project within the OneSignal Integrations Settings.
Message Event Kind (OneSignal) | Message Event Name (Mixpanel) | Event Description |
---|---|---|
Push Sent | Message Sent | Push notification successfully sent |
Push Received | Message Received | Push notification successfully received |
Push Clicked | App Opened from Push | Push notification touched on device |
In-App Message Displayed | App Opened from Push | In-App Message successfully displayed on device |
In-App Message Clicked | Message Opened | In-App Message clicked on device |
In-App Message Page Displayed | In-App Page Displayed | In-App Message page is displayed |
Email Sent | Message Sent | Email successfully sent |
Email Opened | Message Opened | Email opened by recipient |
Email Link Clicked | App Opened from Push | Email link clicked on |
Email Unsubscribed | Email Unsubscribed | Email unsubscribed by recipient |
Email Received | Message Received | Email received by recipient |
Email Reported As Spam | Email Reported As Spam | Email reported as spam by recipient |
Email Bounced | Email Bounced | Email returned to sender due to permanent error |
Email Failed | Email Failed | Could not deliver the email to the recipient’s inbox |
SMS Sent | App Opened from Push | SMS sent to recipient |
SMS Delivered | SMS Received | SMS successfully delivered |
SMS Failed | SMS Failed | SMS failed to send |
Event Properties
These are the properties that are present on any events sent from OneSignal to Mixpanel
PROPERTY NAME | DESCRIPTION |
---|---|
Distinct ID | The external_id associated with the message |
Message ID | The identifier of the discrete message |
Message Name | The message name |
Message Title | The message title |
Message Contents | The message contents |
message_type | The type of message sent, push, in-app, email, SMS |
template_id | The message template used (API and Journey Messages) |
subscription_id | The OneSignal set device/email/sms identifier |
device_type | The device type that received the message |
language | The two character language code of the device |
source | onesignal (is indicated as the source for all events) |
Example Cohorts
Did not click a push or in-app message
With this type of Cohort you can track devices that may not have received your push or in-app message to send them an email or sms text.
Checking the users that did
get a Message Sent
greater than 1
time in the Last Day
, where Message Type equals to push.
AND
Users that Did Not
have the App Opened from Push
(works on web as well) in the Last day
.
Were Shown a Specific Message in the Past Day
Using Message Sent
at least 1 time
, in the Last 7 days
where Message Type
equals in-app
and Message
equals [name of the message]
In this cast the [name of the message]
is pulled from:
- Push Notification Title
- In-App Message Name
FAQ
Can I connect multiple Mixpanel projects to a OneSignal app?
No, only a single Mixpanel project can sync to a single OneSignal app.
How can we pass Subscription events?
Subscription events are not currently being sent automatically. This can be done with the OneSignal SDK Subscription Observer Methods. See Subscription Tracking for more details.
Do unsubscribed devices within my Mixpanel Cohort sync to OneSignal?
Devices not subscribed to push notification or emails will not show in the OneSignal segment's device count. However, sending In-App Messages will reach the unsubscribed devices.
Can I change the cohort name and have that reflected in OneSignal?
Changing the name of a synced Mixpanel Cohort will not show in OneSignal.
Upon syncing cohorts into OneSignal Segments, 2 things happen:
- a OneSignal Segment is created with that cohort name
- a Segment Data Filter is created for that cohort
The OneSignal Segment name can be changed, but the Segment Data Filter will always reflect the original name of the Mixpanel Cohort.
If you want to reflect this change, you will need to create a new Cohort in Mixpanel and sync it to OneSignal with the new name.
Can I setup an Email-only integration?
Yes, OneSignal provides ways to setup email with another ESP for you so you can use OneSignal directly for sending emails.
If you have an account with Mailgun, Mandrill or Sendgrid already, great! You can follow the above steps, except on Step 4, follow the below requirements.
Requirements:
- You will need to create the email record in OneSignal. Use the CSV Email Import or Add a device API.
- You will need to sync a Mixpanel User Property to be the same as the OneSignal External ID property.
Why do my cohort user counts not match the OneSignal segment counts?
There are a couple reasons for this:
- OneSignal tracks devices while Mixpanel tracks users. A single Mixpanel User may have 1+ devices within OneSignal.
- OneSignal's segments only show devices that are subscribed. Unsubscribed devices are not counted or shown in segments.
- The channel record must already exist within OneSignal and each record needs the
external_id
Property to match the corresponding property in Mixpanel. Check your Mixpanel Integrations page for details on what that property is set to.
Why does my delivery data not match between Mixpanel and OneSignal?
There may be a couple reasons for this:
- The Mixpanel User ID property specified and OneSignal's External ID property needs to be set for message data of that device to be tracked.
- Mixpanel measures Users, OneSignal measures Devices. If a user has multiple devices, the sent, clicked and confirmed events will be higher in OneSignal.
Updated 5 months ago