Custom Events

 Tip

See the Custom Events topic guide for a complete overview of this new feature.

Custom Events let you track user activities and key conversions in your app, and tie them back to corresponding push messaging campaigns. An Event can be tracked anywhere in an app where specific user actions are critical to the success of your app. Some examples:

  • A retail app might record an event each time a user makes a purchase following a promotional message. (Did app revenue increase in response to a “Sale” notification?)

  • An entertainment app could record an event each time a user watches a video. (Are users consuming more content because of push notification?)

  • A news app might record an event each time a user shares a story on social media. (Is the content deep-linked from notifications relevant to users?)

Push Attribution Model

Push Attribution— “An event may be attributed to a notification in different ways depending on how the user interacted with the last notification sent to the device. It can be directly or indirectly attributed to a push notification, or be unattributed.”

In order to fully understand the efficacy of your messaging strategy, you must understand which events can or cannot be explained by notifications. In keeping with our long-standing view that notifications impact usage both directly and indirectly, we have applied similar attribution methodology to Custom Events as we have previously to Push Influence.

Setting Up Custom Events

 Note

Custom Events require the 5.0 or later version of the Airship SDK, and are supported on iOS, Android, and Amazon devices.

In addition to any Custom Events that are specifically set in your app’s project code, Airship will automatically track Interactive Notification button taps as Custom Events.

Setting these events in an app is very similar to adding a tag. Below are some use cases with iOS and Android sample code. Event names must not exceed 255 characters or will be ignored. Event values must be between -231 and [231 - 1] else will cause an exception. Events are automatically batched and sent in the background to minimize battery consumption.

Here is an example of a Custom Event in its simplest form, in this case tracking the number of videos played when a user taps a Play button in an app:

iOS

// Create and name an event
UACustomEvent *event = [UACustomEvent eventWithName:@"played_video"];

// Then record it
[[UAirship shared].analytics addEvent:event]

See: iOS Custom Events for details on adding events to your project.

Android and Amazon

// Create and name an event
CustomEvent event = new CustomEvent.Builder("played_video").create();

// Then record it
UAirship.shared().getAnalytics().addEvent(event);

See: Android/Amazon Custom Events for details on adding events to your project.