OneSignal & Mixpanel

A demo of OneSignal & Mixpanel's bi-directional integration that connects these two platforms.

OneSignal's Customer Support Engineer, Jon Fishman, demos our first ever bi-directional integration that connects two powerful platforms, OneSignal & Mixpanel. Watch as we show how our integration allows users to bring together engagement and analytics data to improve customer experiences and more! The transcript of the webinar can be found below.



Okay, let's go ahead and get started.

Hi everybody. My name is Jon. I lead our Support Team here at OneSignal. I'm going to basically just dig into the OneSignal Mixpanel Integration and make sure that we all understand the capabilities so far. Now this is Version 1 of the integration, so there's a lot of cool things that we're working on to continue improving this integration, but I want to basically show what's available now and help you all get started.

Setting Up OneSignal & Mixpanel's Integration

Okay, just to dive right in, when you log into your Mixpanel dashboard and you go to the Integrations tab, to set up OneSignal, you just basically turn this on and follow the prompts to input your OneSignal app ID and REST API key into Mixpanel. And then also, you go into your OneSignal dashboard into the Settings tab and Analytics, and you activate the Mixpanel Integration here where you just link up the Mixpanel keys into OneSignal.

After that, that's Step #1. Then the second step, and all of this is documented in the Mixpanel Integrations guide here. The most crucial step is to make sure that you're sending Mixpanel the OneSignal Player ID. It's just basically the OneSignal user ID. We call it the Player ID and it's the unique user or device identifier for OneSignal.

We actually provide a code. Examples here for JavaScript, Java, Swift. Our SDK actually provide code as well for grabbing that OneSignal Player ID, which you can then send to Mixpanel using the Mixpanel SDK to add this OneSignal_user_id property. After that, you're basically all set.

All of the OneSignal User IDs will be linked to Mixpanel and certain data for a Mixpanel will be linked to OneSignal. At this time, we're tracking that the data shared on the user side would be the first name and last name. That will be added to OneSignal as what's called a data tag. In the OneSignal side, any custom data that gets sent over can be done in the form of a user tag, which is a key-value pair of string or integer data.

We'll get into that in just a minute, but first, I wanted to go back into Mixpanel and highlight some cohort ideas first. Once you have your cohorts set up and the OneSignal User ID is being implemented... Oh, and just to clarify that the OneSignal Player ID, this is assigned to a device when they subscribed to your website. As soon as they subscribe to your website, a Player ID is issued to that device and a record is created at OneSignal.

On mobile, this happens as soon as the user subscribes to push. I'm sorry, as soon as they download it, open the app with the OneSignal SDK. On the website, once they subscribe to push, they get a Player ID. On the mobile side, once they download it, open the app, a user ID, a Player ID is created instantly, and you can then capture and send that to Mixpanel. We recommend doing that each time the user logs in just to verify that it's being sent over.

Okay. And then just down here, again, is another example of adding the first name and last name property with the Mixpanel. This data would actually be sent over to OneSignal as a user tag as well. Any other user tags would need to be set up with the OneSignal SDK at this time.

Okay, great. Now, let's take a look at the cohorts. On the OneSignal end, you probably have a bunch of cohorts already created. In order to get those synced up to OneSignal, you just go to the options button, Export to, and you'll click OneSignal. Now, I already have this one going, but I'll just go ahead and cancel that and show how to start a new export. Sorry about that.

With OneSignal, it will tell you basically how many users are able to be exported. These are how many devices in the cohort have the OneSignal User ID. You can do a one-time export. Basically, this will be, all of the current users in the cohort will be synced over to OneSignal as a one-time thing. It's like a snapshot of the current users that will be sent over, or you can do a dynamic sync. And then dynamic sync is basically, every time users enter or leave the cohort, it will update that data in OneSignal on a 15-minute period. Every 15 minutes, whatever users are currently inside of that cohort will be synced over to OneSignal, whether they enter or leave.


Kylo, yes, this is being recorded. Thanks for asking.

I'm going to just go ahead and begin that sync.

And then about every after 15 minutes, inside of the OneSignal dashboard in the Audience and Segments tab, you can actually sort your segments by name, just clicking this. Here we can see the current Mixpanel cohorts that I'm currently syncing over to OneSignal. The segment is actually automatically created like this, but on the same time, that Mixpanel cohort is also used as what we call a data filter. The OneSignal segments use data filters where basically you can combine them with AND/OR operators to make really granular and advanced segmentations.

If I want it to sync all of my awesome Mixpanel users into OneSignal, I can do that. And then if I have any other data in OneSignal that I wanted to combine in the segments, I can do that as well. You don't have to, but if you want it to, you can combine this with, maybe I just want to target my users in this cohort and they've used the app over three times or something like that. It's just going to be a way to make the integration deeper by leveraging your Mixpanel cohorts and possibly any other data you have in OneSignal. This is just an add-on to that integration.

Once I have that, basically, that data is going to get synced every 15 minutes or just one time like we saw. You can now create messages. I can go to my Messages tab here and I can create push notifications, I can do in-app messages for mobile apps.

Right now, email is not supported. It is being worked on, but it's something that's currently not available. In order to get emails into OneSignal, you're going to have to go into your Audience tab here, and you can actually do a one-time or as many times as you want. You can import emails. You can just go to the All Users tab, Actions, Imports, Update Users, and I can upload my emails as a CSV. I can upload phone numbers for SMS if you want to do that as well. Also, our SDK has options to capture email addresses as well. So definitely a lot of information in our documentation on getting emails synced over. Pretty soon, we will have this available within the Mixpanel Integration as well. So, that's for emails.

Push & In-App Messaging with OneSignal + Mixpanel

Let's talk about push and in-app messaging, so back in Messages, New Push. All of our messaging capabilities basically start in the same way. We define our audience. In this case, we want to target the Mixpanel segment or cohort that we have synced. I'm just going to click my awesome Mixpanel users here. I create my message. Now, this can be just whatever message you want to send. "Welcome to our webinar". You can add your emojis, you can add any custom images you want to do, your launch URL, which is basically what you're going to deep-link to in your app or URL on your website. You can send just a test notification, just to test to yourself to see how it looks.

One more thing is you could add different languages. If you have a lot of users that speak different languages and you want to send them a message translated in their language, you can just select whichever ones you want. For example, I'll click those. We're not going to translate it, but you can put your translations here. If my device is set to these languages, I'll get the translation. Otherwise, it's just going to default to this Any/English message here.

There was a lot of other options. I'm not going to get into all of them since this is mostly just a Mixpanel OneSignal Integration webinar. But there's a lot of great details in our documentation about that. This is like the basics. I can now schedule it and send it.


Now, one thing I do want to highlight about the integration is that, when these messages get sent, that data is also being poured into Mixpanel. On the OneSignal side, when you send the notifications, you can see Total Sent, which is how many people we targeted in the segments of the cohort that we just sent a notification to. How many of those were delivered, meaning how many were sent to the Google and Apple servers. And then of those, it will tell you how many were confirmed. Basically, how many were received by the device specifically.

What's nice about all this information is that this is all available within a Mixpanel. I can now create cohorts based on these different events. If a push message is opened by a user, I can basically use that event, which is the user did Opened App From Push. It's the event type - Opened App From Push. I can also set the timeframe, so at least X amount of times in the last X amount of days.

And then what's really nice is you can also include what was the message. Here, we use the message events property, and all the messages that I've sent are going to be basically introduced into Mixpanel. I can see what that message title was here. Here, the title was the title here, and this is going to be added into Mixpanel automatically. If you don't see it, you can also just basically copy-paste it, the title in there, just to pull it in quicker, if you want to.

Now I know all my users that opened the push that I sent. They opened it at least one time in the last seven days. There's other events you could use. There's the Opened event, which means they actually clicked it and opened the app or the website. Received means that they actually received it. They might have reflected and they might not have, but we know that they received it. And then just Sent, so how many people we actually sent the message to. Whether they opened it, whether they received it or not, we can see how many people we sent it.

The same concepts apply to in-app messaging as well. On the OneSignal side, let's take a look at in-app messages real quick, under the Messages In-app here. You can create in-app messages in OneSignal, and they work in a very similar fashion as push. We define our audience. I'm targeting my Mixpanel users here. And then I create the message, and these in-app messages are great. They can use gifs. You can add animations, you get buttons, you get text, you can do custom events when they click the buttons. We have a lot of guides in how to set those up.

And then I can trigger this whenever I want. Basically, I can trigger it when the user opens the app, I can trigger it after maybe 30 seconds in the app or I can trigger it programmatically with code. I just said a key and a value with the OneSignal SDK. Once that's triggered, it will then show the in-app message while the user is inside the app. And then I schedule it here and I can set up my resending options here.

This is the in-app message. Within that messages, you basically can... similar concept. The in-app message was opened, so the user clicked on the event. They clicked on the in-app message. They clicked somewhere on the in-app message at least X amount of times in the last X amount of days. And then I can also do the same thing where I filter by the message type. Here, you get the all message name from the OneSignal dashboard up here as the Message Name.

Creating Cohorts

Now, I can create cohorts where I can basically know if the user basically either opened an in-app message or sent an in-app message. Basically, they had the in-app message show up on the device.

Those are the different events you can do that are synced within Mixpanel in OneSignal. You can get really, really in-depth here. Basically, if I wanted to, maybe I have that 40%, it's like a big sale going on, or I have a really important message I want to show my users, I could start off as an in-app message and I can basically track like, "Okay, this needs to be shown within the next three days. If it's not, let's send a push." You can easily do that as well. And then let's say the push maybe doesn't get received or maybe doesn't get clicked. Well, then we can set up another message again to maybe show the push again if they still haven't received it or clicked it.


So, that's the overview of the platform as it is at this time. Again, there's a lot of really cool things being worked on, more data syncing happening, more events being pulled in for both email and SMS, lots of upgrades, things in the works, and this integration is the number one priority to continue to be updated as soon as possible.


So, that's about it for my overview. If you have any questions, I'll be happy to take them. Feel free to throw them in the chat or the Q and A, and thanks for joining.

Hi Kylo, just to be aware that this is going to be recorded. It will be available on our YouTube and also in our documentation once it's finished. But if you go to YouTube and then OneSignal, we have a lot of great videos and other webinars that have been recorded. Lots and lots of content. You could probably spend a good amount of time watching tons of videos if you want to.

Is the email messaging integration now fixed with MP? I believe there was an issue in the work.

I'm not sure what MP is. Oh, no. I'm sorry about that. Yeah, obviously Mixpanel. No, we don't have email right now with Mixpanel. Right now Mixpanel and OneSignal only have push notifications and in-app messaging on mobile. You can do push notifications on web, but in-app messaging is purely a mobile feature at this time. But again, this is something we are heavily working on and it should be available pretty soon. This is a high-priority to get this out as soon as possible.

Should we log everything we want to do in OneSignal in Mixpanel?

All the data that you're collecting in Mixpanel, that's perfect. That data can be set up within cohorts and those cohorts synced into OneSignal. The only data that you might want to include in OneSignal, again, data is in the form of data tags, is items that you want to include in a push notification. OneSignal has the ability to do message personalization.

I'll show this, for example. It's just a common, easy to understand example. This is abandoned cart. A user is on your site and maybe they are interested in subscribing or they click some kind of button to show interest and that they want to pay you money at some point. What you can do is, with OneSignal, in our SDK, we have this method called Syntax. A tag again is a key and a value pair of data, and that can be basically anything you want. In this case, whenever I add an item to my cart, I'm tagging the user with the most recent item they added to the cart and the dates that they added the item to the cart.

In this case, I'm adding product name, whatever the product name was. And then Im actually also adding an image to that item. The benefit of this is that now in my OneSignal notifications, I can just say, you've abandoned your cart. And here I'm using tags substitution, and I'm adding that product name here. Whatever that tag is on the user, it will substitute that value here. It'll say like clear shades or your new, awesome whatever item it was. But this could be done for anything. It could be like the user's name, their favorite color, whatever it is, their dog's name. Whatever you want to tell your user that might be specific to that user, you can include that in the notification.


That also works for images. You saw earlier, I'm adding this image URL. You can put that in the notification as well. It just has to be an actual image URL and not just like a URL that's not too directly to an image.

It also works for launch URL also, AKA deep linking. If I maybe want to go to a specific product, I can put my site. The launch URL has to have https://. Or if you're using deep linking on mobile, you can do just like an app or deep-link ://. And then you can put the text substitution somewhere in here, but you must have this protocol at first here.

In terms of data being synced with OneSignal, again, the first name and last name is already being synced as a tag. But if you wanted to add additional data, like the product’s name or anything else that you want to include in the notification, you can do that with tags and do this text substitution. It works within the title, the subtitles for iOS, the message, the image, and the launch URL.

When I set an in-app message to appear on app open, OneSignal fires in-app on my splash screen, the best way to fire the in-app message on my home screen is to set up a trigger to fire it?

Yeah. Basically, depending on how long or how your app is set up, you can trigger the in-app message immediately. Basically, if somebody opens your app, it takes a couple of seconds to load all the SDKs or load all the different things that's happening in the app. But you could show this. Basically, as soon as OneSignal initializes and it triggers, it'll take a couple seconds, but yeah, I don't basically show as soon as the app is open. Or if you know that usually it takes five seconds or six, ten seconds to get everything loaded or something like that, you can wait. You can just easily add this and it will just start showing the in-app message after 10 seconds.

But if you want to show it at a very specific time, maybe the user makes a purchase or the user forgets to finish a tutorial, or the user, maybe it's their second time opening the app and they forgot to do something, you can trigger it. You can detect all that and trigger programmatically with our Add Trigger method. And then you set the trigger key and the value here.

What's nice about this is you can also use integers. Maybe you're detecting some custom thing where it's like, maybe the user has spent $100. Maybe once their purchase is greater than or equal to 100, trigger this in-app message. Or maybe, in this case, it's some kind of like sushi survey. I can do basically like if they purchased sushi greater than $100 or twice. Maybe this is the second time they ordered from my app, and I want to ask them how it was, I can do some kind of survey to see how their experience was.

I don't have an ETA on when the email will be available, email SMS will be available, but the idea is to get it out this quarter

Where can I find the recording?

Again, the recording is going to be on our YouTube channel, but we're also going to add it probably inside of our documentation or have a link inside of our documentation, probably towards the top. I believe we might send the recording to everybody registered for the webinar, but I'm not 100% sure about that. I would highly recommend checking out our YouTube channel, just YouTube, OneSignal. Be our 1000 subscriber. We don't have a giveaway, but that'd be cool.

Thanks for the presentation. We have a single Mixpanel project for multiple apps. Since we have to have multiple OneSignal projects, one for each app, it's quite a poor user experience. Basically, we need to set up integration anew. Other plans to improve this workflow?

No, not really. Each OneSignal app can hold a website and your iOS and your Android app together. Generally, the way to think about OneSignal apps is basically I have my Android app, I have a version of it for iOS, and then those are associated with a website. So, that's how you would have that set up - basically, a single OneSignal app per this combination of information. If you have multiple apps or multiple environments, maybe you're testing on staging versus sandbox for production. You could have multiple OneSignal apps for that as well. You would need to set up a Mixpanel to sync independently with those different apps. Each Mixpanel project will have its own OneSignal app ID to associate with.


Can we cohort our user's Mixpanel and send mail from OneSignal?

I think I went over that a few times. Again, no mail. Email is not available at this time. It is being worked on. It should be available this quarter. More details to follow once we have updates on that.

Okay, I think we got through all the questions. Thanks, everybody, for your time and joining this. Again, this will be available on the YouTube OneSignal channel. Feel free to come back and check that out. Thank you to our 1000 subscribers. You are awesome. Also, please check out our documentation. We'll have a link to the video here as well. This has a lot of great information on how to get set up. Also, the cohort events and data sync is in here as well. Maybe some examples, if you want to see some advanced examples on getting that setup.

All right, thanks for your time, everybody, and have a great rest of your day.