protected function GoogleAnalyticsCounterAppManager::gacGetFeed in Google Analytics Counter 8.3
Instantiate a new GoogleAnalyticsCounterFeed object and query Google.
Parameters
array $parameters:
array $cache_options:
Return value
object
1 call to GoogleAnalyticsCounterAppManager::gacGetFeed()
- GoogleAnalyticsCounterAppManager::reportData in src/
GoogleAnalyticsCounterAppManager.php - Request report data.
File
- src/
GoogleAnalyticsCounterAppManager.php, line 391
Class
- GoogleAnalyticsCounterAppManager
- Class GoogleAnalyticsCounterAppManager.
Namespace
Drupal\google_analytics_counterCode
protected function gacGetFeed(array $parameters, array $cache_options) {
//Instantiate a new GoogleAnalyticsCounterFeed object.
$feed = $this->authManager
->newGaFeed();
if (!$feed) {
throw new \RuntimeException($this
->t('The GoogleAnalyticsCounterFeed could not be initialized. Is Google Analytics Counter authenticated?'));
}
// Make the query to Google.
$feed
->queryReportFeed($parameters, $cache_options);
// Handle errors.
if (!empty($feed->error)) {
throw new \RuntimeException($feed->error);
}
// If NULL then there is no error.
if (!empty($feed->error)) {
$t_arg = [
'@error' => $feed->error,
];
$this->logger
->error('Google Analytics returned an error: [@error].', $t_arg);
}
return $feed;
}