How do I programmatically disable In-App messages or restrict them to show only on certain pages or screens?

Web

By default, Web In-App messages will automatically show once a qualified, targeted user is identified on a page, no matter which page of your site they are on.

However, you may find that you need to disable Web In-App messages programmatically either because messages are not appearing properly on some pages or because you simply only want them to show on certain, select pages. For example, you may want certain messages to only show on pages accessible by login.

You can turn them off by passing the following config option:

mixpanel.set_config({"disable_notifications": true})

Insert this into your init function on every page where you don’t want the messages to appear.

iOS

Be default, iOS In-App messages will automatically show on app open once a user is properly identified in the app and qualifies for the message in Mixpanel.

Should you wish to control when the iOS In-App message is displayed to your end user, you can turn off automatic rendering by setting the config option:

mixpanel.showNotificationsOnActive = NO;

Provided the user has an in-app from our servers, once this configuration is enabled you can call:

[mixpanel showNotification];

This method will render a message at the point at which it is called. You can call this method from any view within your app to render the iOS In-App message.

Read more about customizing iOS In-App messages.

Android

By default, Android In-App messages will automatically show on the start of each new activity once a user is properly identified in the app and qualifies for the message in Mixpanel.

Should you wish to control when the Android In-App message is displayed to your end user, you can turn off automatic rendering by setting the config option in your AndroidManifest.xml:

<meta-data android:name="com.mixpanel.android.MPConfig.AutoShowMixpanelUpdates"
           android:value="false" />

Provided the user has an in-app from our servers, once this configuration is enabled you can call:

MixpanelAPI.getPeople().showNotificationIfAvailable();

This method will render a message at the point at which it is called. You can call this method from any activity within your app to render the Android In-App message.

Read more about customizing Android In-App messages.