function ga_stats_ga_get_accounts in Google Analytics Statistics 7.x
Same name and namespace in other branches
- 7.2 includes/ga.inc \ga_stats_ga_get_accounts()
- 7 includes/ga.inc \ga_stats_ga_get_accounts()
1 call to ga_stats_ga_get_accounts()
File
- inc/
ga.inc, line 115
Code
function ga_stats_ga_get_accounts() {
require_once 'gapi.class.php';
$user = variable_get('ga_stats_email', '');
$password = variable_get('ga_stats_password', '');
if ($user && $password) {
try {
$ga = new gapi($user, $password);
$accounts = $ga
->requestAccountData();
return $accounts;
} catch (Exception $e) {
drupal_set_message('Invalid Google Analytics login.', 'error');
watchdog('ga_stats', 'Invalid Google Analytics login.');
return;
}
}
else {
drupal_set_message(t('Google Analytics Email and password not set - Could not retrieve Account Information.'), 'error');
watchdog('ga_stats', t('Google Analytics email and password not set.'));
}
}