appsflyer-exporter
v0.1.4
Published
Exporter for appsflyer reports
Downloads
11
Readme
appsflyer-exporter
Exporter for appsflyer reports (installs & partners)
Introduction
Wrapper around the Appsflyer Pull API, returns streams.
Example
Exporter.config({
api_token: '',
app_id: '',
export_type: 'web',
// for web -> 'installs_report, partners_report etc.', for 'local' -> local file path
path: 'installs_report',
// The format the exporter should return
format: 'json' (default)
});
var opts = {
from: '2015/02/02',
to: '2015/02/03'
};
// export_type: 'web' will return a web stream via request
var webStream = Exporter.get(opts);
// export_type: 'local' (Default)
var localStream = Exporter.get();
// Once the stream is initiated and starts pushing through
localStream.on('data', function(line){
// The first line sets the exporter headers (.csv first line) and returns line `false`;
console.log(Exporter.csvHeaders);
// Every other line is passed through normally
// If format:'json' (which is the default), you'll get back an
// Object with CSVHeaders as its keys.
console.log(line);
});
Testing
The tests require you to setup the following two ENV vars: APPSFLYER_APPID & APPSFLYER_APITOKEN. You can replace manually in exporter.test.js if you prefer.
Run with npm test
Warning
Appsflyer has throttled requests to the Pull API to 1 req. p/hour. However if you need to run tests etc. you can get in touch with them to lift the restrictions:
https://support.appsflyer.com/entries/58773966-API-Policy
License
appsflyer-exporter
is released under the MIT license. See LICENSE.txt
for the complete text.