Mixpanel

Integrating OneSignal with Mixpanel

📘

Webinar Video!

Checkout our YouTube channel for the Mixpanel Webinar and more!

Mixpanel and OneSignal have joined forces to provide:

FeatureDetails
Personalized messagingBoost engagement with more contextualized messaging from OneSignal, triggered when users enter or exit Mixpanel cohorts
Real-time insightsGain a holistic view of customers by combining Mixpanel in-product user actions and OneSignal message engagement metrics
Data-driven campaignsLeverage product-level user insights for re-engaging campaigns through OneSignal

Requirements

Step 1. Turn on Integration

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

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

Recommended: Select the checkbox to "Use external_user_id to sync events (recommended)".

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.

870

OneSignal messaging events will automatically show up in the activity feed of a user in Mixpanel.

Step 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 User ID.

In this example, you can see the Mixpanel "User ID" property matches the OneSignal External User ID.

Example: Mixpanel User showing "User ID".

Mixpanel > Users > User Profile Properties

Mixpanel > Users > User Profile Properties

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

OneSignal > Audience > Users

OneSignal > Audience > Users

🚧

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.

Step 4. Sync Mixpanel and OneSignal User ID

Syncing user data across OneSignal and Mixpanel requires setting the OneSignal External User 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 User 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.

The Email and SMS Channel Record needs to be sent to OneSignal using the setEmail SDK Method and setSMSNumber SDK Method shown below.

Step 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_user_id property which must match the OneSignal 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 User Id for the specific channel record you are messaging.

After following the above Option 1 or 2, your user data will be synced with OneSignal as follows:

User TypeDetails
Push Subscribers
(Option 1 & 2)
Automatically and silently (not prompted again) moved into OneSignal upon updating the mobile app and/or returning to the website.
Email Subscribers
(Option 1 only)
After setEmail method is called and the OneSignal External User Id for the email record matches the Mixpanel OneSignal User Id property.
SMS Subscribers
(Option 1 only)
After setSMSNumber method is called and the OneSignal External User Id for the sms record matches the Mixpanel OneSignal User Id property.

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

Step 7. Send Messages

See our guides on sending messages based on the channels you use. You can also setup Journeys.

Step 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)

Those have properties
time - the time the event happened
delivery_id - OneSignal notification ID
Message - Push Notification Title/Headings or Email Subject
Message Contents - Push Notification Message/Contents
$source - this is always onesignal
message_type - push/in-app/email/sms

Cohort Events

You can use the following events in Mixpanel. All will have a $source as onesignal.

OneSignal EventMixpanel EventMixpanel Message Event Property
Push Notification Clicked Which Opens the App/WebsiteApp Opened from PushMessage = Push Notification Title/Headings

Message Contents = Push Notification Message/Contents

delivery_id = OneSignal Notification Id.

message_type = push
Push Notification Sent from OneSignalMessage SentMessage = Push Notification Title/Headings

Message Contents = Push Notification Message/Contents

delivery_id = OneSignal Notification Id.

message_type = push
Push Notification Received on Device (Confirmed Deliveries)Message ReceivedMessage = Push Notification Title/Headings

Message Contents = Push Notification Message/Contents

delivery_id = OneSignal Notification Id.

message_type = push
In-App Message ClickedMessage OpenedMessage Name set within OneSignal Dashboard - does not track what was clicked. Use the Click Action ID to send event to Mixpanel.

message_type = in-app
In-App Message Impression (shown to user)Message SentMessage Name set within OneSignal Dashboard

message_type = in-app
Email sent from OneSignalMessage SentMessage = Subject of the email sent from OneSignal

delivery_id = OneSignal Notification Id.

message_type = email
Email received in user's inboxMessage ReceivedMessage = Subject of the email sent from OneSignal

delivery_id = OneSignal Notification Id.

message_type = email
Email opened/viewed in user's inboxMessage OpenedMessage = Subject of the email sent from OneSignal

delivery_id = OneSignal Notification Id.

message_type = email
Email Link ClickedApp Opened from PushMessage = Subject of the email sent from OneSignal

delivery_id = OneSignal Notification Id.

message_type = email
SMS sent from OneSignalMessage SentMessage = Contents of the SMS sent from OneSignal

Message Contents = Contents of the SMS sent from OneSignal

delivery_id = OneSignal Notification Id.

message_type = sms

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

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 User 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_user_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 User 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.