Skip to main content

Revenue - Analytics

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/revenue

Overview

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

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

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

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

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

  • 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.

Limitations

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

Configuration Impact

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

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.