Example: Trigger In-App Message after closing an In-App Message
Sometimes you may want to chain together in-app messages based on specific buttons clicked in a previous in-app message.
Using the Custom Action ID Click Action you can specify an identifier for that click action. It is also recommended to set it to Dismiss on click within the Advanced Options of that block and addTrigger
method to show the in-app message.
In this example, we call the action Name trigger-banner
The action name will be detected upon click within the In App Message Click Handler. Combine this with the addTrigger
method to pass in the identifier and trigger another In-App Message.
For example:
let inAppMessageClickBlock: OSInAppMessageClickBlock = { action in
if let clickName = action.clickName {
print("clickName string: ", clickName)
if clickName == "trigger-banner" {
OneSignal.addTrigger(clickName, "1")
}
}
}
OneSignal.setInAppMessageClickHandler(inAppMessageClickBlock)
In the In-App Message you want to chain after it, set the In-App Trigger to be the click name.
For example, set the click name trigger-banner
to exists.
Updated over 1 year ago