Because of limited background running, events for iOS are divided into pending and immediate events.

Pending events are events with a low priority that can be queued and sent later. These events are added to the database and only sent in the following scenarios:

  • When there is a new launch of the application, and the sending process starts from the handleApplicationLaunch method.
  • When an immediate event is sent.

The following list shows a type of pending event:

  • Session tracking: A user session is tracked, and the following events are sent:Session ended (sessionEnded)

Immediate events are events with high priority that must be sent immediately. When an event is added and stored in the database, an attempt to send it, along with other pending events in the database, starts right away.

The following list shows the different types of immediate events:

  • Click events on a simple notification are currently the only immediate events. Clicks can be one of the following notifications:
    • URL clicked (urlClicked)
    • App opened from notification (appOpened)
    • Dial action clicked (phoneNumberClicked)
  • Opt-in status: When an app is open, the state of the notification opt-in/opt-out status is checked, and based on the results, one of the following events is generated.
    • A user interface push is enabled (uiPushEnabled) under “application” type.
    • A user interface push is disabled (uiPushDisabled) under “application” type.
  • Session tracking: A user session is tracked, and the following events are sent:Session started (sessionStarted)

Example
You can create events by using the following code:

// Send event to Xtify Servers
NSString * eventName = @"Name of event";
NSString * eventType = @"Type of event";
NSDictionary * attributes = @{};

NSString * attribution=nil;
if(userInfo[@"mce"] && userInfo[@"mce"][@"attribution"])
{
attribution = userInfo[@"mce"][@"attribution"];
}

MCEEvent * event = [[MCEEvent alloc] init];
, @"attributes": attributes}];
if(attribution)
{
event.attribution=attribution;
}

[[MCEEventService sharedInstance] addEvent:event immediate:FALSE];

When the server gets an event with type=simpleNotification, it converts it to a universal behavior automatically. They are used for custom events, and the event name is the same as the custom type value. Remember: Universal behaviors must be created before a mobile app message is sent.

To optimize sending events, all available metrics are sent to the database whenever it is connected to the APIs.

Go Back to the Mobile App Messaging home page.

Join The Discussion

Your email address will not be published. Required fields are marked *