You are here

public function GAFeed::obtainAuthorization in Google Analytics Counter 7.2

OAuth step #2: Authorize request token.

File

./GAFeed.lib.inc, line 116
Provides the GAFeed object type and associated methods.

Class

GAFeed
GAFeed class to authorize access to and request data from the Google Analytics Data Export API.

Code

public function obtainAuthorization($token) {
  $this
    ->setHost($this->oAuthHost);
  $this
    ->setQueryPath('accounts/OAuthAuthorizeToken');

  /* hd is the best way of dealing with users with multiple domains verified with Google */
  $params = array(
    'oauth_token' => $token['oauth_token'],
    'hd' => variable_get('google_analytics_counter_hd', 'default'),
  );

  // Check for the overlay.
  if (module_exists('overlay') && overlay_get_mode() == 'child') {
    overlay_close_dialog($this->queryPath, array(
      'query' => $params,
      'external' => TRUE,
    ));
    overlay_deliver_empty_page();
  }
  else {
    drupal_goto($this->queryPath, array(
      'query' => $params,
    ));
  }
}