public function getTopKeyWordsForPeriod($startDate, $endDate, $maxResults = 30)
    {
        $keywordData = [];

        $answer = $this->performQuery($startDate, $endDate, 'ga:sessions', ['dimensions' => 'ga:keyword', 'sort' => '-ga:sessions', 'max-results' => $maxResults, 'filters' => 'ga:keyword!=(not set);ga:keyword!=(not provided)']);

        if (is_null($answer->rows)) {
            return new Collection([]);
        }

        foreach ($answer->rows as $pageRow) {
            $keywordData[] = ['keyword' => $pageRow[0], 'sessions' => $pageRow[1]];
        }

        return new Collection($keywordData);
    }
public function getTopKeyWordsForPeriod($startDate, $endDate, $maxResults = 30)
    {
        $keywordData = [];

        $answer = $this->performQuery($startDate, $endDate, 'ga:sessions', ['dimensions' => 'ga:keyword', 'sort' => '-ga:sessions', 'max-results' => $maxResults, 'filters' => 'ga:keyword!=(not set);ga:keyword!=(not provided)']);

        if (is_null($answer->rows)) {
            return new Collection([]);
        }

        foreach ($answer->rows as $pageRow) {
            $keywordData[] = ['keyword' => $pageRow[0], 'sessions' => $pageRow[1]];
        }

        return new Collection($keywordData);
    }
public function getTopKeyWordsForPeriod ( $ startDate , $ endDate , $ maxResults = 30 ) { $ keywordData = [ ] ; $ answer = $ this -> performQuery ( $ startDate , $ endDate , 'ga:sessions' , [ 'dimensions' => 'ga:keyword' , 'sort' => '-ga:sessions' , 'max-results' => $ maxResults , 'filters' => 'ga:keyword!=(not set);ga:keyword!=(not provided)' ] ) ; if ( is_null ( $ answer -> rows ) ) { return new Collection ( [ ] ) ; } foreach ( $ answer -> rows as $ pageRow ) { $ keywordData [ ] = [ 'keyword' => $ pageRow [ 0 ] , 'sessions' => $ pageRow [ 1 ] ] ; } return new Collection ( $ keywordData ) ; }
Get the top keywords for the given period.

@param \DateTime $startDate
@param \DateTime $endDate
@param int       $maxResults

@return Collection
Get the top keywords for the given period .