src/google_analytics/ga-feeder.js
/**
   *
   * Fetcher for the best Acquisition src on /apptweak.com/aso-blog.
   *
   * @param {Object} config - The config require for the fetch.
   * @return {Promise} - The promisified geckoFormatted result of the fetch
   *
   */
Fetcher for the best Acquisition src on /apptweak.com/aso-blog.
@param {Object} config - The config require for the fetch.
@return {Promise} - The promisified geckoFormatted result of the fetch
Fetcher for the best Acquisition src on / apptweak . com / aso - blog . @param { Object } config - The config require for the fetch . @return { Promise } - The promisified geckoFormatted result of the fetch
async fetchBestAcquisitionSrc(config) {
    const [metrics, dimensions, filters] = [
      ['ga:newUsers'],
      ['ga:source'],
      ['ga:medium', '==', 'referral'],
    ];
    const {
      rows: tops,
    } = await this.requestGAFor({
      'start-date': config['start-date'],
      'end-date': config['end-date'],
      'max-results': 10,
      'sort': '-ga:newUsers',
      metrics,
      dimensions,
      filters,
    });
    switch (config.out) {
      default: return GeckoBoardFormatter.toFunnel(
        tops.map(([title, nbViews]) => [
          title.replace(' - ASO Blog', ''),
          Number.parseInt(nbViews, 10),
        ])
      );
      case 'json':
          return tops.map(([title, nbViews]) => ({
          'source': title,
          'newUsers': nbViews,
        }));
    }
  }
async fetchBestAcquisitionSrc ( config ) { const [ metrics , dimensions , filters ] = [ [ 'ga:newUsers' ] , [ 'ga:source' ] , [ 'ga:medium' , '==' , 'referral' ] , ] ; const { rows : tops , } = await this . requestGAFor ( { 'start-date' : config [ 'start-date' ] , 'end-date' : config [ 'end-date' ] , 'max-results' : 10 , 'sort' : '-ga:newUsers' , metrics , dimensions , filters , } ) ; switch ( config . out ) { default : return GeckoBoardFormatter . toFunnel ( tops . map ( ( [ title , nbViews ] ) => [ title . replace ( ' - ASO Blog' , '' ) , Number . parseInt ( nbViews , 10 ) , ] ) ) ; case 'json' : return tops . map ( ( [ title , nbViews ] ) => ( { 'source' : title , 'newUsers' : nbViews , } ) ) ; } }
Fetcher for the best Acquisition src on /apptweak.com/aso-blog.
Fetcher for the best Acquisition src on / apptweak . com / aso - blog .