function _yandex_metrics_filter_to_date_range in Yandex.Metrics 7
Same name and namespace in other branches
- 6 yandex_metrics.module \_yandex_metrics_filter_to_date_range()
Converts filter value to date range array: array( 'start_date' => 'YYYYMMDD', 'end_date' => 'YYYYMMDD', 'group' => 'week' // It is optional element. );
Parameters
string $filter - (day, yesterday, week, month):
Return value
array
6 calls to _yandex_metrics_filter_to_date_range()
- 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.
- _yandex_metrics_sources_chart in ./
yandex_metrics.module - The function generates pie chart with traffic sources summary.
File
- ./
yandex_metrics.module, line 263 - The main code of Yandex.Metrics module.
Code
function _yandex_metrics_filter_to_date_range($filter) {
switch ($filter) {
case 'day':
return array(
'start_date' => date('Ymd'),
'end_date' => date('Ymd'),
);
case 'yesterday':
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24),
'end_date' => date('Ymd', time() - 60 * 60 * 24),
);
case 'week':
default:
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24 * 6),
'end_date' => date('Ymd'),
);
case 'month':
return array(
'start_date' => date('Ymd', time() - 60 * 60 * 24 * 31),
'end_date' => date('Ymd'),
'group' => 'week',
);
}
}