You are here

function yandex_metrics_reports_retreive_data in Yandex.Metrics 6.2

Same name and namespace in other branches
  1. 8.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_retreive_data()
  2. 8.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_retreive_data()
  3. 7.3 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_retreive_data()
  4. 7.2 yandex_metrics_reports/yandex_metrics_reports.module \yandex_metrics_reports_retreive_data()

This is the helper function to retreive analytic information from Yandex.Metrics.

Parameters

string $service_uri - short uri of service:

array $parameters - associative array with parameters:

string $result_type - result type (json, xml):

7 calls to yandex_metrics_reports_retreive_data()
yandex_metrics_reports_get_counter_for_current_site in yandex_metrics_reports/yandex_metrics_reports.module
Gets counter ID for the current site from Yandex.Metrics.
yandex_metrics_reports_save_popular_content in yandex_metrics_reports/yandex_metrics_reports.module
Fetch Popuplar content from Yandex.metrika and save it to the database.
_yandex_metrics_reports_geo_chart in yandex_metrics_reports/yandex_metrics_reports.module
The function generates pie chart with geographical information on visitors.
_yandex_metrics_reports_popular_content in yandex_metrics_reports/yandex_metrics_reports.module
The function generates the table of popular content.
_yandex_metrics_reports_search_phrases in yandex_metrics_reports/yandex_metrics_reports.module
The function generates content of search phrases table ordered by popularity.

... See full list

File

yandex_metrics_reports/yandex_metrics_reports.module, line 647
The main code of Yandex.Metrics Reports module.

Code

function yandex_metrics_reports_retreive_data($service_uri, $parameters = array(), $result_type = 'json') {
  $parameters['oauth_token'] = variable_get('yandex_metrics_reports_auth_token', '');
  $query_parts = array();
  foreach ($parameters as $key => $value) {
    $query_parts[] = $key . '=' . $value;
  }
  $parameter_string = implode('&', $query_parts);
  $full_service_url = "http://api-metrika.yandex.ru" . $service_uri . "." . $result_type . "?" . $parameter_string;
  return drupal_http_request($full_service_url);
}