Insights API metrics

This page lists the metrics, top-metric categories, and supported periods for the PubNub Insights API. The Insights API requires Insights Premium. The API returns all metrics in UTC.

The Insights API is part of the Admin API. The Admin API reference covers the request details: authentication with an Admin API key, endpoints, parameters, and response codes. Use this page to choose the metric names, category, and period you pass in a request.

EndpointReturnsAdmin API reference
GET /v2/insightsGeneral metrics for an account, app, or keysetgetData
GET /v2/insights/topTop channels and users for an account, app, or keysetgetTopNData

Metric names are case-sensitive. If you request a metric for a period it doesn't support, the Admin API returns 400.

Insights general metrics​

These metrics go in the metric[] parameter of GET /v2/insights.

Channel metrics​

MetricDescription
unique_channelsUnique channels in the selected period
percent_unique_channels_with_messagesPercentage of channels with messages out of all unique channels
unique_channels_combinationUnique channels, unique channels with messages, and unique channels with message chats
channel_patternsChannel activity and performance filtered, sorted, and limited by your parameters

User metrics​

MetricDescription
unique_usersUnique users in the selected period
percent_unique_users_with_messagesPercentage of users with messages out of all unique users
unique_users_combinationUnique users, unique users with messages, and unique users with message chats
new_vs_recurring_usersNew unique users and returning unique users compared with the preceding period
unique_users_by_countryUnique users per country in the selected period

Message metrics​

MetricDescription
messagesMessages published in the selected period
message_by_countryMessages per country in the selected period. Includes timestamps.
top_10_message_typesTop 10 message types for the selected period. Requires a JSON path in Messages Configuration if your payloads do not follow PubNub's message type conventions.

User duration and device metrics​

MetricDescription
avg_user_durationAverage time users stay connected per hour. For users with multiple connections to a channel, uses the longest session.
unique_users_by_duration_timeframeAverage connected time across channels for a specific hour
publishes_by_device_typePublish calls by device type
subscribers_by_device_typeSubscribe calls by device type
unique_users_by_device_typeUnique users by device type

Channel patterns options​

The channel_patterns metric groups channels by name pattern. The filters, orderBy, and limit parameters of GET /v2/insights apply to channel_patterns results.

  • filters supports the operators eq, neq, gt, lt, gte, lte, in, nin, startsWith, endsWith, and contains.
  • orderBy supports the fields timestamp_value, count_messages, count_users, count_subscribers, and count_users_with_messages.
  • limit sets the number of channel_patterns records returned.

Insights top metrics​

These metrics go in the metric[] parameter of GET /v2/insights/top. Each request also needs a category. The filters parameter narrows results to specific channels or users and supports the operators eq, neq, gt, lt, gte, lte, in, nin, and startsWith.

MetricDescription
top_20_channelsTop 20 channels for the selected period and category
top_1000_channelsTop 1000 channels for the selected period and category
top_20_usersTop 20 users for the selected period and category
top_1000_usersTop 1000 users for the selected period and category
top_20_channels_with_user_durationTop 20 channels with average user duration and user counts by duration bucket
top_1000_channels_with_user_durationTop 1000 channels with average user duration and user counts by duration bucket

Insights top metric categories​

The category parameter of GET /v2/insights/top sets how top channels and users are ranked.

CategoryDescription
allAll activity
by_messagesRanked by message count
by_chatsRanked by chat message count
by_subscribersRanked by subscriber count
by_users_with_messagesRanked by users who published messages
by_users_with_chatsRanked by users who published chat messages
by_subscribed_channelsRanked by number of channels subscribed to (users only)

Supported periods for Insights metrics​

Each metric supports only some values of the period parameter. These tables list which periods each metric accepts, including top metrics.

Channel metric periods​

Metrichourlydailyweeklymonthly
unique_channelsYesYesYesYes
percent_unique_channels_with_messagesYesYesYesYes
unique_channels_combinationYesYesYesYes
top_20_channelsYesYesNoNo
top_1000_channelsYesYesNoNo

User metric periods​

Metrichourlydailyweeklymonthly
unique_usersYesYesYesYes
percent_unique_users_with_messagesYesYesYesYes
unique_users_combinationYesYesYesYes
unique_users_by_countryYesYesNoNo
new_vs_recurring_usersNoYesYesYes
top_20_usersYesYesNoNo
top_1000_usersYesYesNoNo

Message metric periods​

Metrichourlydailyweeklymonthly
messagesYesYesYesYes
message_by_countryYesYesNoNo
top_10_message_typesYesYesNoNo

User duration and device metric periods​

Metrichourlydailyweeklymonthly
avg_user_durationYesNoNoNo
unique_users_by_duration_timeframeYesNoNoNo
top_20_channels_with_user_durationYesNoNoNo
top_1000_channels_with_user_durationYesNoNoNo
publishes_by_device_typeYesYesYesYes
subscribers_by_device_typeYesYesYesYes
unique_users_by_device_typeYesYesYesYes

Was this page useful?

Last updated on