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

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".

Mixpanel > Users > User Profile Properties

Mixpanel > Users > User Profile Properties

Example: OneSignal User records shows matching "External ID".

OneSignal > Audience > Users

OneSignal > Audience > Subscriptions

🚧

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.

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:

  1. "One-time export" will send OneSignal the current user data. Best if sending one message only to the current users.
  2. "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.

  1. 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 SentMessage SentPush notification successfully sent
Push ReceivedMessage ReceivedPush notification successfully received
Push ClickedApp Opened from PushPush notification touched on device
In-App Message DisplayedApp Opened from PushIn-App Message successfully displayed on device
In-App Message ClickedMessage OpenedIn-App Message clicked on device
In-App Message Page DisplayedIn-App Page DisplayedIn-App Message page is displayed
Email SentMessage SentEmail successfully sent
Email OpenedMessage OpenedEmail opened by recipient
Email Link ClickedApp Opened from PushEmail link clicked on
Email UnsubscribedEmail UnsubscribedEmail unsubscribed by recipient
Email ReceivedMessage ReceivedEmail received 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
SMS SentApp Opened from PushSMS sent to recipient
SMS DeliveredSMS ReceivedSMS successfully delivered
SMS FailedSMS FailedSMS failed to send

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)

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:

  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.

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.