Get analytics for your messages sent and received. Also the Number of Users Connected at the time using JSON(P) REST API with HTTP GET.
http://www.pubnub.com/analytics-channel? channel=OPTIONAL_CHANNEL_NAME& pub-key=YOUR_PUBLISH_KEY& sub-key=YOUR_SUBSCRIBE_KEY& duration=TIME_OFFSET_IN_MINUTES& ago=START_FROM_X_MINUTES_AGO& limit=RESTULT_AGGREGATION_LIMIT
Exclude the 'channel' argument to perform a blanket scan of all channels.
http://www.pubnub.com/analytics-channel? pub-key=ea1afbc1-70a3-43c1-990c-ede5cf65a542& sub-key=e19f2bb0-623a-11df-98a1-fbd39d75aa3f& duration=10000& limit=100& ago=0
{
"success":true,
"results":10,
"channels":{
"my-channel-abc":{
"2011-06-15 17:18":{
"connections":0,
"received":0,
"sent":5
}
},
"ec2-spot-price-history":{
"2011-06-15 17:18":{
"connections":1,
"received":232,
"sent":232
},
"2011-06-15 17:16":{
"connections":6,
"received":1377,
"sent":257
},
"2011-06-15 17:14":{
"connections":1,
"received":239,
"sent":239
}
}
},
"start":"2011-06-22 15:55:52.752988",
"end":"2011-06-15 17:15:52.752988",
"limit":10,
"message":"Success",
"total":{
"received":1848,
"sent":733
}
}
The results are organized by channel names, then by time. As you can see, the results are aggregated into 2 mintue intervals. The statistics are keyed by a Date Time "2011-06-15 17:14".
PUBNUB.analytics({
channel : 'my-channel', // OPTIONAL
duration : 10, // Minutes Offset
ago : 0, // Minutes Ago
limit : 100, // Aggregation Limit
callback : function(analytics) {
console.log( "Analytics:", analytics )
}
})