Send Mobile In-App Messages for iOS

Mixpanel allows you to create and send richer messages that appear while your iOS app is running. If you are using our in-app messages product, follow these steps:

  1. Include the latest version of the Mixpanel iOS library in your app.
  2. Make sure you are identifying your users in the app.
  3. Create an in-app message on the Messages tab of the Mixpanel website.

Integration 

The Mixpanel iOS library automatically checks for a message when your app loads or resumes from the background.
 
If an unseen message is available for the current user, it displays immediately in an overlay view.
 

Creating a Mobile In-App Message

In Mixpanel you can contact your users directly through your app with in-app messages.

Select Mobile from the pop-up window to see this form:

Screen_Shot_2018-08-22_at_11.05.45_AM.png

Select the size of your message, either "Fullscreen" or "Mini", and the color of the message, either "Light", "Dark", or "Custom".

Insert an image into your message and write your message directly into the preview image.

You can also choose to add an A/B test (link to A/B Test overview doc) to your push notification by selecting ADD AN A/B TEST.

Controlling When to Show an In-App Message

By default, mobile in-app messages shows immediately when your app loads.

However, it is possible to customize this behavior and control exactly when an in-app message appears.

If, for example, you have a game and would like to show a message when a user accomplishes a goal, you must turn off the automatic showing of messages by setting showNotificationOnActive to NO and call showNotificationWithID at the appropriate point in your app.

// In application:didFinishLaunchingWithOptions:
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:
    YOUR_MIXPANEL_TOKEN];
// Turn this off so the message doesn't pop up automatically.
mixpanel.showNotificationOnActive = NO;

- (void)playerFinishedLevel
{
    [mixpanel showNotificationWithID:INAPP_NOTIFICATION_ID];
}

If you don't want to specify the message ID, you can use showNotification, which shows the first available in-app message targeted at the identified user, if there is one.

Messages are never shown twice to the same user, so you don't have to check if the user already saw the message before calling showNotificationWithID.

If you don't want Mixpanel to check for new in-app messages when your app becomes active, you can turn it off by setting checkForNotificationsOnActive to NO.

This action sets in-app messages not to show automatically, and that the network request to retrieve the messages will occur only when you call showNotification or showNotificationWithID. 

Using Profile Properties

Similar to emails, in-app messages replace content wrapped in {{}}.

For example, if you add a Location property to your user profiles, you can send messages like this:

Come and visit us at our {{ ${Location} }} office.

A user with a profile property Location: Asheville will get this message:

"Come and visit us at our Asheville office."
 
If some of your profiles have a value, but others don't, you can use a fallback value:
 
Come and visit us at our {{ ${Location} | fallback:"nearest" }} office!

Profiles without a Location property will receive this message:

"Come and visit us at our nearest office!"
Is this article helpful?
0 out of 9 found this helpful

Comments

0 comments

Article is closed for comments.