BatchMessagingDelegate
@protocol BatchMessagingDelegate
Implement this protocol if you want to be notified of what happens to the messaging view (for example, perform some analytics on show/hide).
-
Called when the message view appeared on screen.
Declaration
Objective-C
- (void)batchMessageDidAppear:(id)messageIdentifier;
Parameters
messageIdentifier
Analytics message identifier string. Can be nil.
-
Called when the message view was dismissed by a user interaction (close button tap, swipe gesture…)
Declaration
Objective-C
- (void)batchMessageWasCancelledByUserAction:(id)messageIdentifier;
Parameters
messageIdentifier
Analytics message identifier string. Can be nil.
-
Called when the message view was dismissed automatically after the auto closing countdown.
Declaration
Objective-C
- (void)batchMessageWasCancelledByAutoclose:(id)messageIdentifier;
Parameters
messageIdentifier
Analytics message identifier string. Can be nil.
-
Called when Batch needs to present a message in automatic mode.
Implement this method if you need to specify the view controller that will present Batch content. If you return nil, or don’t implement this method, Batch will default to its normal presentation behaviour and use the topmost presented controller of your app’s key window’s root controller.
Note
This method will not be called for some messages that need to be presented in their own window.Declaration
Objective-C
- (id)presentingViewControllerForBatchUI;
Return Value
The view controller to present Batch content on. Batch will display its controller modally, therefore the view controller you return must be capable of presenting a modal view controller.
-
Called when the message view will be dismissed due to the user pressing a CTA or the global tap action.
Declaration
Objective-C
- (void)batchMessageDidTriggerAction:(BatchMessageAction *_Nonnull)action messageIdentifier:(id)identifier actionIndex:(id)index;
Parameters
action
Action that will be performed. Fields can be nil if the action was only to dismiss the message on tap. DO NOT run the action yourself: the SDK will automatically do it.
index
Index of the action/CTA. If the action comes from the “global tap action”, the index will be BatchMessageGlobalActionIndex If the index is greater than or equal to zero, you can cast the action to BatchMessageCTA to get the CTA’s label.
identifier
Analytics message identifier string. Can be nil.
-
Called when the message view disappeared from the screen.
Declaration
Objective-C
- (void)batchMessageDidDisappear:(id)messageIdentifier;
Parameters
messageIdentifier
Analytics message identifier string. Can be nil.
-
Called when an In-App message should be presented to the user.
Declaration
Objective-C
- (void)batchInAppMessageReady:(nonnull BatchInAppMessage *)message;
Parameters
message
In-App message to show.
-
Called when the message view was closed because of an error
Declaration
Objective-C
- (void)batchMessageWasCancelledByError:(id)messageIdentifier;
Parameters
messageIdentifier
Analytics message identifier string. Can be nil.
-
Called when the WebView message view will be dismissed due to the user navigating away or triggering an action (using the Javascript SDK).
- or the ‘batchAnalyticsID’ query parameter of a link.
Declaration
Objective-C
- (void)batchWebViewMessageDidTriggerAction: (BatchMessageAction *_Nullable)action messageIdentifier:(id)messageIdentifier analyticsIdentifier:(id)analyticsIdentifier;
Parameters
action
Action that will be performed. Fields can be nil if the action was only to dismiss the message on tap. DO NOT run the action yourself: the SDK will automatically do it. Can be nil.
messageIdentifier
Analytics message identifier string. Can be nil.
analyticsIdentifier
Click analytic identifier. Matches the “analyticsID” parameter of the Javascript call,