v3.3.0
Parsing query results #43
resultParsers
is an array of functions and the response from API will be parsed by each function.
import KeenAnalysis from 'keen-analysis';
const client = new KeenAnalysis({
projectId: 'YOUR_PROJECT_ID',
readKey: 'YOUR_READ_KEY',
resultParsers: [
(value) => {
return Math.round(value);
}
]
});
client.query({
analysis_type: 'count',
event_collection: 'pageviews',
timeframe: 'this_3_months'
})
.then(res => {
// Handle results
})
.catch(err => {
// Handle errors
});