____ _ _ ____ _ _~ | __ )| | __ _ ___| | __ | __ ) ___ __ _ _ __ __| | _~ )_)_~ | _ \| |/ _` |/ __| |/ / | _ \ / _ \/ _` | '__/ _` | )_))_))_) | |_) | | (_| | (__| < | |_) | __/ (_| | | | (_| | _!__!__!_ |____/|_|\__,_|\___|_|\_\ |____/ \___|\__,_|_| \__,_| \_____EB/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pirate Metrics for Node.js
A simple API for pushing events to Pirate Metrics.
Install the module:
npm install blackbeard
Use it in your script, set your API key:
var bb = require('blackbeard');
bb.key = 'PMKey';
Make an AARRR call:
bb.acquisition('pirate@example.com', function(err, res) {
// Handle stuff...
});
Maybe you want to do a few at once:
var pirates = [
{email : 'jacksparrow@example.com'},
{email : 'barbossa@example.com'}
{email : 'davyjones@example.com'}
];
bb.acquisitions(pirates, function(err, res) {
// Handle stuff...
});
Each of the five AARRR events is represented, along with sister functions for bulk events. The email and occurred_at properties should always be strings.
Any invalid optional params will be striped before pushing the event. For example, if level is passed to acquisition as a string, it will be omitted from the event because it is expected to be a number.
All callbacks take two arguments: error and response.
callback(error, response) { ... }
If there is an error, response will be null.
-
acquisition(email[,level][,occurred_at], callback) - level should always be a number.
-
acquisitions(data, callback) - data is an array of acquisition objects {email:""[,level:0][,occurred_at:""]}.
-
activation(email[,occurred_at], callback)
-
activations(data, callback) - data is an array of activation objects {email:""[,occurred_at:""]}.
-
retention(email[,occurred_at], callback)
-
retentions(data, callback) - data is an array of retention objects {email:""[,occurred_at:""]}.
-
referral(customer_email, referree_email[,occurred_at], callback) - referree_email is the customer gained and customer_email is the email who referred them. Both should always be strings.
-
referrals(data, callback) - data is an array of referral objects {customer_email:"",referree_email:""[,occurred_at:""]}.
-
revenue(email, amount_in_cents[,occurred_at], callback) - amount_in_cents should always be a number.
-
revenues(data, callback) - data is an array of referral objects {customer_email:"",amount_in_cents:0[,occurred_at:""]}.