Outcomes

Track events and actions within your app or site resulting from push notifications and in-apps from OneSignal.

OneSignal allows you to track various Outcomes (events or actions) resulting from push notifications and in-apps.

This includes tracking things you care about like event counts (e.g. how many users purchased a product), sums (useful for tracking revenue), or unique events (counted only once).

📘

Webinar Video

Watch our latest Outcomes webinar here.

Outcome Types

There are 3 types of Outcomes:

OutcomeDescriptionDetails
Notification ClicksTracks number of clicks/opens on a push notification.A click is generated when the user presses the notification which triggers the app or site to open and removes the notification from the device.

Clicks always measured with direct attribution.
Session DurationCOUNT: Number of sessions that resulted from a push notification.
SUM: Cumulative session time of all sessions resulting from a push notification (in seconds).
Professional Plan Required:

A new session is created when a user clicks a notification resulting in the app opening.

If a notification is clicked but app is already open, then no new session is created.
Custom OutcomeAny custom outcome such as purchase amount, action taken by the user, or any other outcome of interest.Professional Plan Required:

This is set with code.

Limit of 100 custom outcomes

Attributions

Outcomes can be attributed to a notification directly from a click or influenced by a notification received. This depends on if a session is created by the notification click which opens the app or website from being closed. If a notification is not clicked or received when the outcome is triggered it is an unattributed outcome.

If a user has the app or site open and clicks the notification, a session is not created and the Outcome will be influenced. Similarly, if up to 10 notifications are sent and never clicked, but the user performs the Outcome within the specified Attribution Window (default 24 hours), then up to all 10 notifications will track the outcome as influenced.

Clicks (count) will always be directly attributed to a notification and do not rely on a session.

AttributionDescription
DIRECTThe Outcome happened during a session that was created due to a clicked push.
INFLUENCEDThe Outcome was registered within the Attribution Window (default 24 hours) of the push but didn’t occur during a session directly initiated from a push.

Note: Only the 10 most recently sent notifications (per device) get influenced attribution
UNATTRIBUTEDThe Outcome was registered outside of a message click and the Attribution Window. It therefore is not associated with any specific message.
TOTALSum of Direct + Influenced Outcomes when viewing the Message Reports.

Sum of Direct + Influenced + Unattributed when viewing the Delivery > Outcomes table.

Direct Opens

The push notification was clicked, opened the app or website from a new session (app or website not open in the past 30 seconds) and the user performed the action which triggered the Outcome.

Influenced Opens

Inside Settings > Analytics

Outcomes performed when a user receives a push within the Attribution Window but does not click the push. Instead they open the app or website directly.

Attribution Window - the amount of time influenced Outcomes can be attributed to a notification. You can set 15 minutes, 1 hour and 24 hours which is default.

1842

If you keep the Attribution Window to the default 24 hour maximum, any Outcome Types except Clicks will show in the Outcomes table for up to 10 most recent notifications.

For example:

  • Attribution Window set to 24 hours and you send 15 notifications that day.
  • UserA does not click any notifications but opens the app.
    Then the last 10 most recent notifications will have updated Session Duration count and sum.
    If you also specified a Custom Outcome, like the user buys a product, then the last 10 notifications will also show that Custom Outcome in the Outcomes Table.

Count Vs Sum

For Session Duration and Custom Outcomes, there are two metrics available: count and sum

MetricDescription
COUNTThe frequency of the Outcome (how many times it occurred)
SUMThe sum of all Outcome values (only available for Outcomes that register values)
365

Outcome Values

One of Outcomes' most powerful features is the ability to store numeric values in the Sum Row with the firing of each Outcome.

Note: Outcomes with values always round to the nearest whole number.

For example, you may want to track how much revenue can be attributed to a push campaign. In this example, you can register a monetary value with a Custom Outcome such as a purchase. Simply pass an outcome name with the number you wish to associate it with. You can then see these data in the Message Report page for any given push notification.

// "Purchase" button pressed in the app
   ...
   OneSignal.sendOutcomeWithValue("Purchase", 18.76);
// "Purchase" button pressed in the app
   ...
   [OneSignal sendOutcomeWithValue:@"Purchase" value:18.76]
//Purchase Button pressed on site
OneSignal.sendOutcome("Purchase", 20.20);
let value = "20.20"//you supply the value
OneSignal.sendOutcome(withValue: "Purchase", value: NSNumber(value:value), onSuccess: {outcomeSent in
  print("outcome sent: \(outcomeSent!.name) with random value: \(value)" )
})
//Send an outcome
OneSignal.Default.SendOutcome("outcomeName");

//Send a unique outcome
OneSignal.Default.SendUniqueOutcome("uniqueOutcomeName");

//Send an outcome with a float value
OneSignal.Default.SendOutcomeWithValue("outcomeWithVal", 4.2f);
497

Session Duration

Sessions are created when the user opens the app or website from previously being closed.

A direct session is registered when the user opens the app or site from a push.
An influenced session is registered when the user opens the app within the Attribution Window (default 24 hours).

Sessions become apparent in Message Reports after the session is finished (user leaves app or site).

If you send up to 10 notifications and the user visits the app or website within the Attribution Window, then all 10 notifications will be counted towards Influenced Session Duration count and sum.

📘

App or Website Closed

App or Website closed refers to when a user has fully quit your app or website. If the App or Website is in the background, and the user brings it to the foreground, a new session will not apply.


Implementing Outcomes

Default Outcomes

Update to the latest version of the SDK. Free users automatically get clicks right out of the box. Paid plan users will get clicks and sessions.

Custom Outcomes

Add a line of code where you want an Outcome to fire (e.g. on "add to cart" button or "upgrade subscription" button).

There are three methods for custom Outcome types:

MethodDescription
sendOutcomeIncreases the "Count" by 1 and will be counted each time sent.
sendOutcomeWithValue
Web: sendOutcome
Increases the "Count" by 1 and the "Sum" by the value. Will be counted each time sent.
sendUniqueOutcomeIncreases "Count" by 1 only once. This can only be attributed to a single notification. If the method is called outside of an attribution window, it will be unattributed until a new session occurs.

📘

Example Outcomes Code

See below Outcomes Examples for more on implementation.

🚧

Missed Outcomes

Failures for Outcomes are cached on the device and re-attempted on the next OneSignal init.


Reports

Each Message Report contains all Outcome Statistics related to that notification as well as information such as delivery numbers, click-through rate, and influenced opens.

You can also view a cumulative graph of all outcomes over the past 30 days in Delivery > Outcomes.

1205

Outcomes can be viewed as a graph...

1180

or as a table:

503

Examples

E-Commerce Site

Online stores can use OneSignal push notifications to drive users back to abandoned carts, flash sales, promotions, and more. With Outcomes, store owners can now easily correlate push notifications to user actions such as an add-to-cart, purchase, or coupon redeemed. For purchases, outcomes go even further than simple counts and can track purchase amounts. This allows site owners to easily view the sum total of revenue generated from individual pushes.

OneSignal.sendOutcomeWithValue("Purchase", 18.76);
[OneSignal sendOutcomeWithValue:@"Purchase" value:18.76]
OneSignal.sendOutcome("Purchase", 18.76);
OneSignal.Default.SendOutcomeWithValue("Purchase", 18.76);

Dating app

Online dating apps may want to re-engage users by using a push to notify them of a match, a new like, or simply to get them swiping. By using Outcomes, a dating app developer can see whether a push notification led to a user event such as initiating a chat with a match or a 34-second swipe session. These data can then be used to refine notification and targeting strategies.

In the following example, we want to track whether a user started swiping dating profiles after a push. Since we wouldn't want to count every swipe as a conversion, we use sendUniqueOutcome

This "Swipe" outcome will only be attributed once to the push that triggered it. Examples:

  • If the user clicked the push and performed the action which called this method, it will be a direct attribution.
  • If user received the push but did not click it and performed the action within in the attribution window, it will be an influenced attribution. Even if they later click the same push and performed the action again, it will still only be influenced.
  • If user performs method outside of an attribution window, it will be unattributed once per session.
OneSignal.sendUniqueOutcome("Swipe");
[OneSignal sendUniqueOutcome:@"Swipe"]
//OUTCOME WITH UNIQUE VALUES COMING SOON TO WEB
OneSignal.sendOutcome("my_outcome_event");
OneSignal.Default.SendUniqueOutcome("swipe");

Pushes Clicked By Language

Within the Notification Opened/Clicked Event of our SDK, you can setup Outcomes to increment how many devices clicked a push by their set language. This will require some native code to detect the language of the device, but you can then pass that language into the Outcome like so:

public void notificationOpened(OSNotificationOpenResult result) {
  String languageCode = Locale.getDefault().getLanguage();
  System.out.println("languageCode " + languageCode);
  OneSignal.sendOutcome(languageCode);
}
let notificationOpenedBlock: OSHandleNotificationActionBlock = { result in
  // This block gets called when the user reacts to a notification received
  if let languageCode = Locale.current.languageCode {
      print ("languageCode: " + languageCode);
      OneSignal.sendOutcome(languageCode);
}
}
var language = navigator.language
OneSignal.sendOutcome(language);

Pushes Clicked By Operating System and Browser

Within the Notification Opened/Clicked Event of our SDK, you can setup Outcomes to increment which platform's specifically were clicked. This is generic for iOS and Android as you can set OneSignal.sendOutcome("iOS") or OneSignal.sendOutcome("Android") in your mobile app's click handler, but if you want to track web push platforms as well, you can use this for example:

// Example taken from Stackoverflow: https://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript
var os = "Unknown OS";
if (navigator.userAgent.indexOf("Win") != -1) os = "Windows";
if (navigator.userAgent.indexOf("Mac") != -1) os = "Macintosh";
if (navigator.userAgent.indexOf("Linux") != -1) os = "Linux";
if (navigator.userAgent.indexOf("Android") != -1) os = "Android";
if (navigator.userAgent.indexOf("like Mac") != -1) os = "iOS";
console.log('Your os: ' + os);

var browserType = "Unknown Browser Type";
if (navigator.userAgent.indexOf("Safari") != -1) browserType = "Safari";
if (navigator.userAgent.indexOf("Chrome") != -1) browserType = "Chrome";
if (navigator.userAgent.indexOf("OPR") != -1) browserType = "Opera";
if (navigator.userAgent.indexOf("Firefox") != -1) browserType = "Firefox";
console.log('Your Browser: ' + browserType);

OneSignal.push(["addListenerForNotificationOpened", function(data) {
  OneSignal.sendOutcome(os);
  OneSignal.sendOutcome(browserType);
}]);

FAQ

What platforms are supported?

Make sure you have the minimum SDK version or higher installed. We recommend using the latest version of the OneSignal SDK.

What happens if a device is offline?

Data for fired outcomes are queued to be sent to OneSignal once the device is online again.

How long is outcome data stored?

  • Notifications sent from the dashboard keep their Outcome data forever.
  • Notifications sent via the API have a 30-day retention of outcomes before being purged.

Can I export outcomes?

You can export a set of outcomes or all outcomes as a CSV. We also provide API access to outcomes for an individual notification or for all the notifications.

Can I store strings as values in Custom Outcomes?

This is not supported

If a user backgrounds the app after clicking a notification and then comes back to it, firing an Outcome, is it counted direct or influenced?

As long as the user returns to the app within 30 seconds after backgrounding it, the session will still be considered the original session and will get direct attribution.

Do outcomes work with SMS or email?

Currently outcomes work with push notifications and In-App Messages.

Outcomes sent through In-App messages will show as "Unattributed" and will set a tag on the device in format:
outcome name : true.

When does the new Attribution Window take affect?

If you change the attribution window from 24 hours to 1 hour for example, then the 1 hour window will take affect on a per-device basis once each device opens the app from a brand new session. This new session is created after 30 seconds of being outside the app.

Why is Safari not logging outcomes?

Outcomes for web requires the use of service workers to track outcome events. Since Safari does not implement Service Workers in the same way as Chromium based browsers, it will not track outcomes as Direct or Influenced, but will be tracked as Unattributed.

Why do sessions not match with other analytics?

OneSignal only counts a session after the user has left the app for over 30 seconds. If you close the app or website and return to it within 30 seconds, it will not be a new session.

For instance, Apple's analytics tracks the session as the number of times the app has been used for at least two seconds. If the app is in the background and is later used again, that counts as another session.