View the details of all the outcomes associated with your app.

Overview

This API allows you to export push notification Outcomes (events or actions). This includes click, confirmed and session tracking along with things you care about like action counts (e.g. how many users purchased a product), sums (useful for tracking revenue), or unique events (counted only once).

See our Outcomes guide for more details on setting custom Outcomes.

📘

Outcome Data Limitations

Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.


How to use this API

This API allows you to export both default and custom Outcome data with the ability to filter by time range, platform, and attribution.

outcome_names

The name of the Outcomes you want to fetch with the accompanying aggregation type (.count or .sum).

  • os__click = represents push clicks detected by OneSignal's SDK. Only works with the count aggregation.
  • os__confirmed_delivery = represents push confirmed delivery detected by OneSignal's SDK. Use with count aggregation.
  • os__session_duration = represents the amount of sessions created as detected by OneSignal's SDK.
  • Custom Outcome names = Outcomes you sent to OneSignal.
    • If custom Outcome name contains any commas, then specify only one value per request.
    • Example: "Sales, Purchase" is the Outcome name. outcome_names=os__click.count,Sales, Purchase.count

outcome_time_range

The time range values can be one of the following:

  • 1h = (default) the last 1 hour data.
  • 1d = the last 1 day data.
  • 1mo = the last 1 month data.

outcome_platforms

Maps to the subscription type property. Default is data from all platforms enabled for your OneSignal App.

device_typetype
0iOSPush
1AndroidPush
2FireOSPush
5ChromePush
8FirefoxPush
11Email
14SMS
17SafariPush

Example: outcome_platform=0 for iOS outcome_platform=17,8 for Safari and Firefox.

For a complete list, see device_type integer values codes for Add a device API .


outcome_attribution

The way in which the Outcome occurred:

  • direct = the Outcome occurred when the user interacted with the message. Some Outcomes only have direct attribution like os__click and os__confirmed_delivery because they only occur as the direct result of the message.
  • influenced = the Outcome occurred within the Time Window of the message being sent, but the user never interacted with the message. See Outcomes for details.
  • unattributed = the Outcome occurred without a direct or influenced attribute.
  • total = (default) the sum of direct+influenced+unattributed.

Example

Fetch the direct Outcome data for push clicks and confirmed delivery for the past day.

curl --request GET \
     --url 'https://api.onesignal.com/apps/YOUR_APP_ID/outcomes?outcome_names=os__click.count,os__confirmed_delivery.count&outcome_time_range=1d&outcome_attribution=direct' \
     --header 'Authorization: Basic YOUR_REST_API_KEY' \
     --header 'accept: application/json'

Response

{
    "outcomes": [
        {
            "value": 28687,
            "id": "os__click",
            "aggregation": "count"
        },
        {
            "value": 499490,
            "id": "os__confirmed_delivery",
            "aggregation": "count"
        }
    ]
}

value

The returned value of the aggregation type.

id

The name of the Outcome. Similar to outcome_names without the aggregation set in the request.

aggregation

The type of aggregation requested in the outcome_names. Can be count or sum.

Language