Retrieve domain statistics for a given time frame
var Cloudflare = require('machinepack-cloudflare');
// Retrieve domain statistics for a given time frame
Cloudflare.stats({
token: '8afbe6dea02407989af4dd4c97bb6e25',
email: '[email protected]',
domain: 'example.com',
interval: 20,
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// Authentication could not be completed.
notAuthorized: function () {
},
// Some other input was not valid.
invalidInput: function () {
},
// You have exceeded your allowed number of API calls.
apiLimit: function () {
},
// OK.
success: function (result) {
},
});
The API key made available on your Cloudflare account page.
'8afbe6dea02407989af4dd4c97bb6e25'
The e-mail address associated with your Cloudflare account.
'[email protected]'
The target domain.
'example.com'
The The time interval for the statistics.
20
An unexpected error occurred.
Authentication could not be completed.
Some other input was not valid.
You have exceeded your allowed number of API calls.
OK.
{
timeZero: 1333051372000,
timeEnd: 1335643372000,
count: 1,
has_more: false,
objs: [
{
cachedServerTime: 1335816172000,
cachedExpryTime: 1335859372000,
trafficBreakdown: {
pageviews: { regular: 2640, threat: 27, crawler: 4 },
uniques: { regular: 223, threat: 16, crawler: 4 }
},
bandwidthServed: { cloudflare: 78278.706054688, user: 58909.374023438 },
requestsServed: { cloudflare: 4173, user: 3697 },
pro_zone: false,
pageLoadTime: null,
currentServerTime: 1335824051000,
interval: 20,
zoneCDate: 1307574643000,
userSecuritySetting: 'Medium',
dev_mode: 0,
ipv46: 5,
ob: 0,
cache_lvl: 'agg'
}
]
}