Skip to main content

Revenue - Analytics

Endpoint

/o/revenue

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Returns revenue analytics merged with paying-user timeline data for selected IAP events.

Authentication

Authentication methods:

  • API Key (parameter): api_key=YOUR_API_KEY
  • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Revenue: Read permission.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
eventsString or JSON ArrayYesRevenue event key(s). Example: events=["Purchase","Buy"]
periodStringYesPeriod descriptor (for example 30days)
no_cacheBoolean/StringNoBypass cached query results

Configuration Impact

SettingDefaultAffectsUser-visible impact
apps.plugins.revenue.iap_events[]Paying-user calculation (p values)Defines which incoming SDK events count as purchases

Response

Success Response

{
"2026": {
"2": {
"15": {
"u": {
"e": {
"Purchase": { "c": 3, "s": 44.97 }
},
"s": 12
},
"p": 1
},
"p": 1
},
"p": 1
},
"lu": 1739629204
}

Response Fields

FieldTypeDescription
YYYYObjectYear bucket
YYYY.MMObjectMonth bucket
YYYY.MM.DDObjectDay bucket
uObjectSession + event aggregate for that bucket
u.eObjectEvent aggregates keyed by event name
u.sNumberSession count
pNumberPaying users count
luNumberLast update timestamp

Error Responses

  • HTTP 400 - Missing auth:
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • HTTP 401 - Invalid auth:
{
"result": "User does not exist"
}

Behavior/Processing

  • Normalizes events into an array when needed.
  • Loads session model for the requested period.
  • Calculates paying users from configured IAP events and merges into response model.
  • Returns raw merged object with time buckets and p counters.

Database Collections

CollectionUsed forData touched by this endpoint
countly.appsApp configuration and metadataStores app-level feature settings and metadata used or modified by this endpoint.
countly.usersUser aggregatesStores app-level user aggregate counters/metrics read or updated by this endpoint.
countly_drill.drill_eventsDrill event recordsStores granular event rows queried or updated by this endpoint.

Examples

/o/revenue?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&events=["Purchase","Buy"]&period=30days
/o/revenue?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&events=Purchase&period=7days&no_cache=true

Limitations

  • Meaningful revenue output depends on correctly configured iap_events and event sums.
  • Large periods can trigger long-running processing.

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions.


Last Updated

2026-02-16