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. Not supported on free plans.
  • Your OneSignal app needs Users. This integration does not create users. It maps the users in Mixpanel to those in OneSignal. See our Channel setup docs to get started.
    • If using push notifications, you need the OneSignal Mobile SDK and/or Web SDK.
    • If using Email and/or SMS, you can Import email addresses and phone numbers.
  • Set the OneSignal External ID to match a user ID set in Mixpanel. More details below.

Setup

Add Mixpanel to OneSignal

In OneSignal, navigate to Data > Integrations > Mixpanel and click Activate.

In Mixpanel:

  1. Find your Project Token then copy-paste it into OneSignal.
  2. Check your Data Residency. If using Mixpanel's EU servers, check the Send events exclusively to Mixpanel's EU Residency Server box.

Select message events

Select which OneSignal message events you want to send to Mixpanel. When finished, click Activate.


Add OneSignal to Mixpanel

In Mixpanel, navigate to your Integrations and connect OneSignal. See Mixpanel Integrations for more details.

Set the Connector Name as something identifiable like OneSignal - APP_NAME where APP_NAME is the name of the app in OneSignal. This is important because you can have multiple OneSignal apps connect to the Mixpanel project.

You will need the following data available in OneSignal Settings > Keys & IDs :

  1. App ID
  2. API Key

USER ID PROPERTY

The Mixpanel-OneSignal integration does not create users in OneSignal. It only maps users that exist within both platforms.

In order to map the users in OneSignal and Mixpanel, you need to set the OneSignal External ID to match an available user property in Mixpanel.

The User ID Property refers to any Mixpanel user property that has the same value as the OneSignal External ID.

Example shows the Mixpanel integration "User ID" property maps to the OneSignal External ID.

Example shows the Mixpanel integration "User ID" property maps to the OneSignal External ID.

Verify the User ID Property you selected is available in your Mixpanel user profile properties.

Mixpanel > Users > User Profile Properties

Mixpanel > Users > User Profile Properties

The same value in Mixpanel for the user profile property must match the External ID in OneSignal.

OneSignal > Audience > Users

OneSignal > Audience > Users > 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 match 109768518080488203109 or $device:1880c06821f1b3-052354675cde95-1d525634-1fa400-1880c06821f1b3.

Use caution when setting Distinct ID if used for the User ID Property mapping.

Use caution when setting Distinct ID if used for the User ID Property mapping.

Click Continue when finished.

👍

Integration setup complete!

You should now be able to export cohorts from Mixpanel to OneSignal and collect message events from OneSignal to Mixpanel.


Export Mixpanel Cohorts to OneSignal

You can sync the users within your Mixpanel cohorts to the users within OneSignal as long as they have the matching User ID/External ID property discussed in the setup instructions above. Exporting user data from Mixpanel does not create the user in OneSignal, the user must already exist and have the matching External ID.

In your Mixpanel Cohorts find the cohort you want to sync, then select Options > Export to... > The OneSignal connection name.

Example shows exporting the cohort to the correct OneSignal integration as set in the setup instructions above.

Example shows exporting the cohort to the correct OneSignal integration as set in the setup instructions above.

Export to OneSignal options

Under "Export Type" you have 2 options:

  1. One-time export will send OneSignal the current user data. Best if sending one message only to the current users.
  2. Recurring sync is where Mixpanel will send us the updated cohort user data around every 15 minutes. Best if sending recurring messages to updated user list.

Select the option and press Begin Sync.


The Mixpanel Cohort will appear as a "Mixpanel Segment filter" in OneSignal, allowing you to combine it with other filters. For a segment to also be created in OneSignal using this filter:

  1. The users in the Mixpanel Cohort must also exist in OneSignal with matching External ID.
  2. You must not exceed your segment limit in OneSignal.

If both conditions are met, OneSignal will automatically generate a segment using the Mixpanel Cohort filter and name the Cohort.

See Segments for more details on filters.

Example shows the (Mixpanel) All Users in Mixpanel segment created because the users existed within OneSignal with the correct External ID-User ID mapping.

Example shows the "(Mixpanel) All Users in Mixpanel" segment created because the users existed within OneSignal with the correct External ID-User ID mapping.

🚧

Missing users in OneSignal?

See Why don't my cohort & segment counts match?



Track Message Events in Mixpanel

Depending on which message events you enabled in the setup, they will be accessible within Mixpanel in real time as they occur.

To test this, send yourself a message from OneSignal, then navigate to your user profile page in Mixpanel.

Within the Activity Feed, you should see the events populate:

Message 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 SentMessage SentPush notification successfully sent.
Push ReceivedMessage ReceivedPush notification successfully received.
Push ClickedApp Opened from PushPush notification touched on device.
Push FailedPush FailedPush failed to be sent. Check the failed message report in OneSignal.
Push UnsubscribedPush UnsubscribedThe Subscription unsubscribed from push.
In-App ImpressionMessage SentIn-App Message successfully displayed on device.
In-App ClickedMessage OpenedIn-App Message clicked on device.
In-App Page DisplayedIn-App Page DisplayedIn-App Message page is displayed.
Email SentMessage SentEmail successfully sent.
Email ReceivedMessage ReceivedEmail received by recipient.
Email OpenedMessage OpenedEmail opened by recipient.
Email Link ClickedApp Opened from PushEmail link clicked on.
Email UnsubscribedEmail UnsubscribedEmail unsubscribed by recipient.
Email Reported As SpamEmail Reported As SpamEmail reported as spam by recipient.
Email BouncedEmail BouncedEmail returned to sender due to permanent error.
Email FailedEmail FailedCould not deliver the email to the recipient’s inbox.
Email SuppressedEmail SuppressedThe email address is on your suppression list. Either it bounced or marked your emails as spam.
SMS SentApp Opened from PushSMS sent to recipient.
SMS FailedSMS FailedSMS failed to send.
SMS DeliveredSMS ReceivedSMS successfully delivered.
SMS UndeliveredSMS UndeliveredThe SMS could not be sent.

Event Properties

These are the properties that are present on any events sent from OneSignal to Mixpanel

PROPERTY NAMEDESCRIPTION
Distinct IDThe external_id associated with the message.
Message IDThe identifier of the discrete message.
Message NameThe message name.
Message TitleThe message title.
Message ContentsThe message contents.
message_typeThe type of message sent, push, in-app, email, SMS.
template_idThe message template used (API and Journey Messages).
subscription_idThe OneSignal set device/email/sms identifier.
device_typeThe device type that received the message.
languageThe two character language code of the device.
sourceonesignal (is indicated as the source for all events)

🚧

Why doesn't my delivery data match between Mixpanel and OneSignal?

See Why doesn't my delivery data match between Mixpanel and OneSignal?

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

Why don't my cohort & segment counts match?

There are two main reasons why your Mixpanel Cohort user count may not match the OneSignal Segment user count:

1. Missing Users or Incorrect External ID

For users to sync between Mixpanel and OneSignal, they must exist in OneSignal with the correct External ID matching the Mixpanel User ID. The Mixpanel integration does not create Users or Subscriptions in OneSignal. Users without an External ID or with a mismatched ID won’t sync.

Refer to Channel setup to get started creating users and subscriptions.

2. Segments Count Subscribed Subscriptions

OneSignal segments count only subscribed subscriptions. Users with unsubscribed subscriptions won’t be included in the segment but remain available for Journeys or In-app messages.

For example, if an Mixpanel cohort has 10 users but the OneSignal segment shows 8 subscriptions, the 2 missing users may:

  1. Not exist in OneSignal or have an incorrect External ID.
  2. Have unsubscribed subscriptions.

To verify, check the Audience > Users tab in OneSignal to see if the users exist and have active subscriptions.


Do unsubscribed devices within my Mixpanel Cohort sync to OneSignal?

Unsubscribed subscriptions are not counted in the OneSignal segment at this time. However, those users do exist within the segment so they will be counted if used for Journeys and unsubscribed mobile subscriptions can receive In-app messages.


Why doesn't my delivery data match between Mixpanel and OneSignal?

In OneSignal, Users are identified by their External ID, which must match the Mixpanel User ID for event tracking to align across platforms.

Each user can have multiple Subscriptions, for example, lets say a user has 2 Android devices, 1 iOS device, 2 web push subscriptions, 1 email address, and 1 phone number. This means the user has 7 subscriptions.

When sending messages to users, they are being sent to their eligible subscriptions. If you send a push notification to this user, it could potentially generate 5 sent events, 5 received events, and 5 click events.

In the message event properties, you should see the subscription_id property to know which subscription performed the event.

To troubleshoot missing events:

  • Ensure OneSignal.login is called whenever a user is identified to set the External ID.
  • Verify that OneSignal.logout isn't removing the External ID.
  • Check API requests or CSV uploads that may alter the External ID.

For more details, see Users.


How can we pass user or subscription events?

User and subscription events like accepting/denying push permissions, user logging in/out, and other events are not currently being sent automatically.

The OneSignal SDK has event listeners that can be used to track these events for you to send to Mixpanel:


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:

  1. a OneSignal Segment is created with that cohort name
  2. 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.