Analytics
Track push notification performance — overview stats, daily breakdown, message type distribution, hourly activity, recent sends.
Track push notification performance with detailed analytics. Every analytics endpoint is available both through the Node.js SDK and the REST API. These endpoints return data for the whole project, so they need the server secret (x-server-secret) as well as the API key; the API key alone is refused.
Total
Messages sent
Delivered
Successfully
Failed
Delivery failures
Rate
Success %
Get Overview#
Get overall statistics for your push notifications.
Node.js SDK
import { AbrovaPush } from '@abrova/push-node';
const abrovaPush = new AbrovaPush({
apiKey: 'ab_live_your_api_key',
serverSecret: 'ab_srv_your_server_secret',
});
const overview = await abrovaPush.analytics.getOverview();REST API
curl -X GET "https://push-api.abrova.ir/analytics/overview" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
{
"totalMessages": 15420,
"totalDelivered": 14890,
"totalFailed": 530,
"totalPending": 0,
"totalNoTargets": 12,
"totalAttempts": 3210,
"deliveryRate": 97,
"totalDevices": 2500,
"activeDevices": 2100,
"platformDistribution": {
"android": 1400,
"ios": 900,
"web": 200
}
}Daily Statistics#
Get message statistics broken down by day. days defaults to 30 (max 90); days with no sends are returned with zeros. sent counts messages (API sends), while delivered and failed count individual devices.
Node.js SDK
const daily = await abrovaPush.analytics.getDaily(30);
REST API
curl -X GET "https://push-api.abrova.ir/analytics/daily?days=30" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
[
{
"date": "2024-01-15",
"sent": 12,
"delivered": 510,
"pending": 0,
"failed": 10
},
{
"date": "2024-01-16",
"sent": 9,
"delivered": 475,
"pending": 0,
"failed": 5
}
// ... more days
]Message Type Breakdown#
See how messages are distributed by send type (user / device / topic / broadcast). percentage is rounded to a whole number.
Node.js SDK
const messageTypes = await abrovaPush.analytics.getMessageTypes();
REST API
curl -X GET "https://push-api.abrova.ir/analytics/message-types" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
[
{ "type": "user", "count": 8500, "percentage": 55 },
{ "type": "topic", "count": 4200, "percentage": 27 },
{ "type": "broadcast", "count": 2000, "percentage": 13 },
{ "type": "device", "count": 720, "percentage": 5 }
]Hourly Distribution#
Analyze message distribution by hour of day (UTC). days defaults to 7 (max 30); all 24 hours are always returned.
Node.js SDK
const hourly = await abrovaPush.analytics.getHourly(7);
REST API
curl -X GET "https://push-api.abrova.ir/analytics/hourly?days=7" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
[
{ "hour": 0, "count": 120 },
{ "hour": 1, "count": 85 },
{ "hour": 2, "count": 45 },
// ...
{ "hour": 12, "count": 650 },
{ "hour": 13, "count": 580 },
// ...
{ "hour": 23, "count": 180 }
]Recent Activity#
Get the most recent messages sent. limit defaults to 10 (max 50). Each item is a full message record.
Node.js SDK
const recent = await abrovaPush.analytics.getRecent(10);
REST API
curl -X GET "https://push-api.abrova.ir/analytics/recent?limit=10" \ -H "x-api-key: ab_live_your_api_key" \ -H "x-server-secret: ab_srv_your_server_secret"
Response
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"type": "user",
"target": "user_123",
"title": "New message",
"body": "You have a new notification",
"successCount": 2,
"failedCount": 0,
"status": "delivered",
"createdAt": "2024-01-15T10:30:00Z"
},
{
"id": "6fa459ea-ee8a-3ca4-894e-db77e160355e",
"type": "device",
"target": "device_abc",
"title": "Order update",
"body": "Your order has shipped",
"successCount": 1,
"failedCount": 0,
"status": "delivered",
"createdAt": "2024-01-15T10:25:00Z"
}
]