-
Notifications
You must be signed in to change notification settings - Fork 19
Events
The new "Events" feature has been released in Mobile Messaging SDK version 6.1.0. Events are an integration point for our "Moments" engagement platform. They allow you to track arbitrary user actions and collect arbitrary contextual information represented by event key-value properties. The event data collected on our servers might be later used to:
- build segments of recipients for the Flow message campaigns;
- get insights about user behaviour.
Find more info on Infobip docs.
Standard events are enabled for all the Moments users who have Mobile SDK implemented in their mobile app, and you don’t need to perform any additional actions to be able to track them. List of standard events:
- Personalize
- Depersonalize
- Install
- Uninstall
- App Launch
Custom events are those that you have defined yourself and want to track via Mobile SDK.
The Event needs to be first defined on the Portal. Once defined on Portal side, it can be accepted by Mobile Messaging SDK integrated within your mobile app.
According to this event definition, the resulting event can be initialized within your app as follows:
let props = [
"itemCode" : "I-001" as NSString,
"amount" : 1500.5 as NSNumber,
"purchaseDate" : NSDate(),
"isPremiumUser" : true as NSNumber
]
let event = MMCustomEvent(definitionId: "EventExample", properties: props)
expand to see Objective-C code
NSDictionary * props = @{
@"itemCode" : @"I-001",
@"amount" : @1500.5,
@"purchaseDate" : [NSDate date],
@"isPremiumUser" : @YES
};
MMCustomEvent * event = [[MMCustomEvent alloc] initWithDefinitionId:@"EventExample" properties: props];
[MobileMessaging submitEvent:event];
In order to send the event to the server, you have two options to choose from:
-
Using
submitEvent
API with a callback argument in case you need to immediately send an event to the server:MobileMessaging.submitEvent(event, completion: { error in < handle error if not nil > })
expand to see Objective-C code
[MobileMessaging submitEvent:event completion:^(NSError * _Nullable error) { if (error != nil) { //< handle error if not nil > } }];
in this case you have to handle possible connection or server errors, do retries yourself.
-
Using
submitEvent
API without the callback argument:MobileMessaging.submitEvent(event)
expand to see Objective-C code
[MobileMessaging submitEvent:event];
in this case the Mobile Messaging SDK will eventually send the event to the server, it will also handle possible errors and do retries for you.
After the successful submission, the new event will appear in the Person screen, under the Events tab:
Please note the "App Launch" and "Install" events on the screenshot above - these events are not custom ones but our internal standard events, the Mobile Messaging SDK submits them automatically for you. Full list of standard events is: "App Launch", "Install", "Uninstall", "Personalize", "Depersonalize".
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
- Geofencing service
- Privacy settings
- In-app chat
- WebRTC Calls and UI