function ga_stats_ga_get_accounts in Google Analytics Statistics 7
Same name and namespace in other branches
- 7.2 includes/ga.inc \ga_stats_ga_get_accounts()
 - 7.x inc/ga.inc \ga_stats_ga_get_accounts()
 
Collect GA account for UI display.
Parameters
gapi $client:
Return value
array
1 call to ga_stats_ga_get_accounts()
- ga_stats_admin_settings in ./
ga_stats.admin.inc  - Callback for the GA Stats admin form.
 
File
- includes/
ga.inc, line 235  
Code
function ga_stats_ga_get_accounts($client) {
  if (!isset($client)) {
    return array();
  }
  try {
    $accounts = $client
      ->requestAccountData(1, 5000);
  } catch (Exception $e) {
    drupal_set_message(t('Could not retrieve accounts from Google Analytics.'), 'error');
    watchdog('ga_stats', $e
      ->getMessage(), array(), WATCHDOG_ERROR);
    return array();
  }
  return $accounts;
}