In-App Message Delivery
Trigger Types
Our in-app message product allows you to trigger an in-app message display as a result of several different event types: Any Purchase
, Specific Purchase
, Session Start
, Custom Event
, Push Click
. Furthermore, Specific Purchase
and Custom Event
triggers can contain robust property filters.
Delivery Semantics
All in-app messages that a user is eligible for are automatically downloaded to the user’s device/browser upon a session start event, and triggered according to the message’s delivery rules. For more information about the SDK’s session start semantics, see our session lifecycle documentation.
Minimum Time Interval Between Triggers
By default, we rate limit in-app messages to once every 30 seconds to ensure a quality user experience. To override this value, you can pass the minimumIntervalBetweenTriggerActionsInSeconds
configuration option to your initialize
function.
1
2
// Sets the minimum time interval between triggered in-app messages to 5 seconds instead of the default 30
appboy.initialize('YOUR-API-KEY', { minimumIntervalBetweenTriggerActionsInSeconds: 5 })
Manual In-App Message Display
If you don’t want your site to immediately display new in-app messages when they’re triggered, you can disable automatic display and register your own display subscribers. First, find and remove the call to appboy.display.automaticallyShowNewInAppMessages()
from within your loading snippet. Then, create your own logic to custom handle a triggered In-App Message, where you show or don’t show the message:
1
2
3
4
5
6
7
8
9
10
appboy.subscribeToInAppMessage(function(inAppMessage) {
// Display the in-app message. You could defer display here by pushing this message to code within your own application.
// If you don't want to use Braze's built-in display capabilities, you could alternatively pass the in-app message to your own display code here.
if ( should_show_the_message_according_to_your_custom_logic ) {
appboy.display.showInAppMessage(inAppMessage);
} else {
// do nothing
}
});
If you don’t remove appboy.display.automaticallyShowNewInAppMessages()
from your website when also calling appboy.display.showInAppMessage
, the message may be displayed twice.
The inAppMessage
parameter will be an appboy.InAppMessage
subclass or an appboy.ControlMessage
object, each of which has various lifecycle event subscription methods. See the JSDocs for full documentation.
Only one
Modal
orFull
in-app message can be displayed at a given time. If you attempt to show a second Modal or Full message while one is already showing,appboy.display.showInAppMessage
will return false, and the second message will not display.
Local In-App Messages
In-app messages can also be created within your site and displayed locally in real-time. All customization options available on the dashboard are also available locally. This is particularly useful for displaying messages that you wish to trigger within the app in real-time. However, analytics on these locally-created messages will not be available within the Braze dashboard.
1
2
3
4
// Displays a slideup type in-app message.
var message = new appboy.SlideUpMessage("Welcome to Braze! This is an in-app message.");
message.slideFrom = appboy.InAppMessage.SlideFrom.TOP;
appboy.display.showInAppMessage(message);
Exit-Intent Messages
Exit-intent in-app messages appear when visitors are about to navigate away from your site. They provide another opportunity to communicate important information to users, while not interrupting their experience on your site.
To be able to send these messages, first add an exit entent library, such as this open-source library to your website. Then, use the code below to log ‘exit intent’ as a custom event. In-app message campaigns can then be created in the dashboard using ‘exit intent’ as the trigger custom event.
1
2
3
var _ouibounce = ouibounce(false, {
callback: function() { appboy.logCustomEvent('exit intent'); }
});