greta v1.0.1
Greta
Greta API client for Node.js
Installation
npm install greta
How to Use
purgeAll
var greta = require('greta')('yourapikey');
greta.purgeAll(function (err, obj) {
if (err) { // Oh no!
return console.dir(err);
}
console.dir(obj); // Response body from the Greta API
});
Calling purgeAll function will empty all users cache completely. This will empty the actual end user browser cache. If you are using a CDN, remember to empty it beforehand, otherwise your CDN might serve old content from their POPs.
stats
var greta = require('greta')('yourapikey');
var time = "24"; //time can be: 24, 7, 30, 90
greta.stats(function (time, err, obj) {
if (err) { // Oh no!
return console.dir(err);
}
console.dir(obj); // Response body from the Greta API
});
Calling status will give you a summery of your Greta usage. This summery is very similar to what you can find at your dashboard.
The response contains:
data:
p2p = Bytes received from peers
cache = Bytes taken from the cache
server = Bytes loaded from the server/CDN
users:
pageviews = Number of page views registered by Greta
pops = Number of users that were able to send content to others
desktop = Number of page views from a desktop browser
tablet = Number of page views from a tablet browser
phone = Number of page views from a phone browser
pops_right_now = Number of users that are able to send content right now
You can get this data for different time periods by setting time to one of the following: 24, 7, 30, 90
Testing
npm test