Skip to content

v3.3.0

Compare
Choose a tag to compare
@dariuszlacheta dariuszlacheta released this 12 Feb 11:49
· 77 commits to master since this release

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
  });