function yandex_metrics_retreive_data in Yandex.Metrics 6
Same name and namespace in other branches
- 7 yandex_metrics.module \yandex_metrics_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_retreive_data()
- yandex_metrics_get_counter_for_current_site in ./
yandex_metrics.module - Gets counter ID for the current site from Yandex.Metrics.
- yandex_metrics_save_popular_content in ./
yandex_metrics.module - Fetch Popuplar content from Yandex.metrika and save it to the database.
- _yandex_metrics_geo_chart in ./
yandex_metrics.module - The function generates pie chart with geographical information on visitors.
- _yandex_metrics_popular_content in ./
yandex_metrics.module - The function generates the table of popular content.
- _yandex_metrics_search_phrases in ./
yandex_metrics.module - The function generates content of search phrases table ordered by popularity.
File
- ./
yandex_metrics.module, line 781 - The main code of Yandex.Metrics module.
Code
function yandex_metrics_retreive_data($service_uri, $parameters = array(), $result_type = 'json') {
$parameters['oauth_token'] = variable_get('yandex_metrics_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);
}