OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

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

Setup

Make sure you have added the OneSignal Mobile SDK and/or Web SDK and have started collecting Subscribers.

OneSignal to Mixpanel

Step 1 Turn on Integration

Navigate to your onesignal.com Dashboard > Settings > Analytics and toggle on Mixpanel

Step 2 Add Mixpanel Token in OneSignal dashboard

You can find your Mixpanel token under "Access Keys" in your "Project Settings". See Mixpanel's "Find Project Token" guide.

If you are using Mixpanel EU servers, select Send events exclusively to Mixpanel EU servers.

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

Step 3 Send Mixpanel the OneSignal User ID

Through the Mixpanel API, set OneSignal User ID $onesignal_user_id to the people property like so:

OneSignal.push(function() {
  OneSignal.getUserId().then(function(userId) {
    console.log("OneSignal User ID:", userId);
    mixpanel.people.set("$onesignal_user_id", userId)  
  });
});
//Example from: https://developer.mixpanel.com/docs/java#setting-profile-properties
import com.mixpanel.mixpanelapi.MessageBuilder;
import com.mixpanel.mixpanelapi.MixpanelAPI;

MessageBuilder messageBuilder =
    new MessageBuilder(PROJECT_TOKEN);
//OneSignal method to get the player id (user id)
OSPermissionSubscriptionState status = OneSignal.getPermissionSubscriptionState();
String userId = status.getSubscriptionStatus().getUserId();//String: the OS Player Id or null if device has not registered with OS Servers

// Sets Mixpanel user 13793's "$onesignal_user_id" property
JSONObject props = new JSONObject();
props.put("$onesignal_user_id", userId);
JSONObject update = messageBuilder.set("13793", props);

// Send the update to mixpanel
MixpanelAPI mixpanel = new MixpanelAPI();
mixpanel.sendMessage(update);
let status: OSPermissionSubscriptionState = OneSignal.getPermissionSubscriptionState()
let userId = status.subscriptionStatus.userId
print("userId = \(userId)")
Mixpanel.mainInstance().people.set(properties: [ "$onesignal_user_id":userId])

Mixpanel to OneSignal

  1. Add the OneSignal App ID and REST API Key into your Mixpanel dashboard.
  2. Click ‘Export Cohorts to OneSignal’ (One time export or Dynamic sync)
  3. Mixpanel Cohort will automatically show up in the OneSignal dashboard as a segment of users that can be used in a messaging campaign

Syncing Data

Push Subscribers will be automatically and silently (not prompted again) moved into OneSignal upon updating the mobile app or returning to the website. New Users can be prompted like you used to or using OneSignal's Prompting options.

Email Addresses can be Imported in a one-time step to immediately message your userbase.

In OneSignal, Mixpanel Cohorts will show up as a Segment data filter. (OneSignal "Segments" is just what we call cohorts).

  • Data will be synced from Mixpanel to Onesignal around every 2 hours.
  • OneSignal also automatically syncs 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.

In Mixpanel, OneSignal Push Notification and In-App Message events like messages delivered, opened, and clicked will show up in the activity feed of a user.

Updated a day ago



Mixpanel


Integrating OneSignal with Mixpanel

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.