Skip to main content
GET
View in-app message stats

Overview

Retrieve impression and click totals for an in-app message by its UUID. Without group_by, the response is one row of totals for the whole in-app message. With group_by, the response is one row per page, per clickable element, or per combination of the two. All totals are all-time. This endpoint has no date range or granularity option, and it does not split totals by language or device type. Use the in-app message report in the dashboard for a timeseries view.

How to use this API

Authenticate with your App API Key. Find an in-app message’s id from the View in-app messages API.

Group the totals

group_by accepts page_name, element_name, or both. Send the values comma-separated (group_by=page_name,element_name) or as a repeated parameter (group_by[]=page_name&group_by[]=element_name).
  • A page is one card of a carousel and only applies to carousel in-app messages created in the dashboard. A custom HTML in-app message has a single page.
  • A clickable element of a custom HTML in-app message is named by its data-onesignal-unique-label value. See the in-app message JavaScript API.

Filter the rows

A filter must be paired with its dimension in group_by. For example, group_by=element_name&element_names=cta-button reports one element, and group_by=page_name&element_names=cta-button is rejected with a 400. Filter values are split on commas. A page or element whose name contains a comma cannot be named in a filter. Omit the filter and select its row from the response instead.

Choose which clicks to count

click_type sets what the clicks field counts.
  • all (default) counts every click.
  • first counts only the first click a user makes on the in-app message. Later clicks are not counted, whether on the same element or a different one. A row’s clicks is then the number of times one of its elements was the first thing clicked.

Response

A successful request returns 200 OK. payload.stats is an array with one row per group. This example is a carousel grouped by page and clickable element:
Impressions are never counted per element. For a carousel they are counted per page, so every element row on the same page repeats that page’s impressions. For every other in-app message, including every custom HTML in-app message, they are counted once for the whole in-app message, so every row repeats the same number. Do not add impressions across rows. clicks can be added across rows.
An in-app message with no clickable elements returns no rows when grouped by element_name.

Totals for the whole in-app message

Without group_by, stats holds exactly one row with no group fields:
  • impressions is the number of times the in-app message was displayed. A carousel counts once per display, not once per page viewed.
  • clicks adds up every clickable element, including elements and pages since removed from the in-app message.
  • With click_type=first, clicks counts only the first click on the in-app message. A user who clicks two different elements adds one click, not two.

Headers

Authorization
string
default:Key YOUR_APP_API_KEY
required

Your App API key with prefix Key. See Keys & IDs.

Path Parameters

app_id
string
default:YOUR_APP_ID
required

Your OneSignal App ID in UUID v4 format. See Keys & IDs.

id
string
default:YOUR_IN_APP_MESSAGE_ID
required

UUID of the in-app message to retrieve stats for.

Query Parameters

group_by
enum<string>[]

Dimensions each row is grouped by: page_name, element_name, or both, comma-separated. Omit for a single row of totals for the whole in-app message.

Available options:
page_name,
element_name
click_type
enum<string>
default:all

Which clicks the clicks field counts. all counts every click. first counts only the first click a user makes on the in-app message. Later clicks on any element are not counted.

Available options:
all,
first
page_names
string[]

Only include these pages, comma-separated. Requires page_name in group_by.

element_names
string[]

Only include these clickable elements, comma-separated. For custom HTML in-app messages, element names are the data-onesignal-unique-label values. Requires element_name in group_by.

show_deleted_pages
boolean
default:false

Include pages that have been removed from the in-app message. No effect without group_by.

show_deleted_elements
boolean
default:false

Include clickable elements that have been removed from the in-app message. No effect without group_by.

Response

200

success
boolean

true when the request succeeded.

payload
object