src/google_analytics/ga-feeder.js
/**
   *
   * Fetcher for the visitors on /apptweak.com.
   *
   * @param {Object} config - The config require for the fetch
   * @return {Promise} - The promisified geckoFormatted result of the fetch
   *
   */
Fetcher for the visitors on /apptweak.com.
@param {Object} config - The config require for the fetch
@return {Promise} - The promisified geckoFormatted result of the fetch
Fetcher for the visitors on / apptweak . com . @param { Object } config - The config require for the fetch @return { Promise } - The promisified geckoFormatted result of the fetch
async fetchNbUniqueVisitors(config) {
    const metrics = ['ga:newUsers'];
    const query = {
      'current': {
        'start-date': config['start-date'],
        'end-date': config['end-date'],
        metrics,
      },
      'last': {
        'start-date': config['last-start-date'],
        'end-date': config['last-end-date'],
        metrics,
      },
    };
    const [{
      totals: current,
    }, {
      totals: last,
    }] = await Promise.all([
      this.requestGAFor(query.current),
      this.requestGAFor(query.last),
    ]);
    return GeckoBoardFormatter.toNumberAndSecondStat({
      'value': Number.parseInt(current[metrics[0]]),
    }, {
      'value': Number.parseInt(last[metrics[0]]),
    });
  }
async fetchNbUniqueVisitors ( config ) { const metrics = [ 'ga:newUsers' ] ; const query = { 'current' : { 'start-date' : config [ 'start-date' ] , 'end-date' : config [ 'end-date' ] , metrics , } , 'last' : { 'start-date' : config [ 'last-start-date' ] , 'end-date' : config [ 'last-end-date' ] , metrics , } , } ; const [ { totals : current , } , { totals : last , } ] = await Promise . all ( [ this . requestGAFor ( query . current ) , this . requestGAFor ( query . last ) , ] ) ; return GeckoBoardFormatter . toNumberAndSecondStat ( { 'value' : Number . parseInt ( current [ metrics [ 0 ] ] ) , } , { 'value' : Number . parseInt ( last [ metrics [ 0 ] ] ) , } ) ; }
Fetcher for the visitors on /apptweak.com.
Fetcher for the visitors on / apptweak . com .
// const filters = ['ga:userType', '=~', 'New'];