Bitrix Site Manager

CTraffic::GetDailyList

CDBResult
CTraffic::GetDailyList(
 string &by = "s_date",
 string &order = "desc",
 array &max_min, 
 array filter = array(),
 bool &is_filtered,
 string get_maxmin = "Y"
)

The method GetDailyList returns the number of hits, hosts, sessions, visitors, events; rates of visitors' attentiveness on daily basis.

Parameters

Parameter Description
by Sorting field; possible values:
  • s_id - the record ID;
  • s_date - date;
  • s_hits - hit count;
  • s_hosts - host count;
  • s_sessions - session count;
  • s_events - event count;
  • s_guests - visitor count;
  • s_new_guests - number of new visitors ;
  • s_favorites - number of visitors who added to Favorites.
order Sort order; the following values are possible:
  • asc - ascending;
  • desc - descending.
max_min Reference to an array containing minimum and maximum dates of the returned list. The array has the following structure:
Array
(
    [DATE_FIRST] => minimum date
    [MIN_DAY] => day of the minimum date (1-31)
    [MIN_MONTH] => month of the minimum date (1-12)
    [MIN_YEAR] => year of the minimum date

    [DATE_LAST] => maximum date
    [MAX_DAY] => day of the maximum date (1-31)
    [MAX_MONTH] => month of the maximum date (1-12)
    [MAX_YEAR] => year of the maximum date
)
filter Array used to filter the resulting list. The following keys can be used in the array:
  • ID* - the record ID;
  • ID_EXACT_MATCH - if "N", entry in the ID is sufficient (loose match);
  • DATE1 - the earliest date and time of the time period for which the information is to be returned;
  • DATE2 - the latest date and time of the time period;
  • HITS_1 - minimum value of the "hit count" field;
  • HITS_2 - maximum value -//-;
  • HOSTS_1 - minimum value of the "hosts count" field;
  • HOSTS_2 - maximum value -//-;
  • SESSIONS_1 - minimum value of the "session count" field;
  • SESSIONS_2 - maximum value -//-;
  • EVENTS_1 - minimum value of the "event count" field;
  • EVENTS_2 - maximum value -//-;
  • GUESTS_1 - minimum value of the "visitor count" field;
  • GUESTS_2 - maximum value -//-;
  • NEW_GUESTS_1 - minimum value of the "new visitor count" field;
  • NEW_GUESTS_2 - maximum value -//-;
  • FAVORITES_1 - minimum value of the "number of visitors who added to favorites" field;
  • FAVORITES_2 - maximum value -//-;
  • SITE_ID* - the site ID;
  • SITE_ID_EXACT_MATCH - if "N", entry in the SITE_ID is sufficient (loose match).
* - complex logic allowed.
is_filtered If this flag contains "true" on return, the resulting list is filtered.
get_maxmin If set to "Y", on method return, the parameter max_min will contain an array of max and min dates of the returned list.

Structure of the returned record

Array
(
    [ID] => the record ID
    [DATE_STAT] => date
    [DAY] => day (1-31)
    [MONTH] => month (1-12)
    [YEAR] => year
    [WDAY] => day of week
              (0 - Monday,
               1 - Tuesday, ... 
               6 - Sunday)
    [HITS] => hit count
    [C_HOSTS] => host count
    [SESSIONS] => session count
    [C_EVENTS] => event count
    [GUESTS] => visitor count
    [NEW_GUESTS] => new visitor count
    [FAVORITES] => number of visitors who added to Favorites.
    [TOTAL_HOSTS] => host count
    [AM_AVERAGE_TIME] => average duration of session
    [AM_1] => number of sessions with duration < 1 min.
    [AM_1_3] => number of sessions with duration from 1 to 3 min.
    [AM_3_6] => -//- from 3 to 6 min.
    [AM_6_9] => -//- from 6 to 9 min.
    [AM_9_12] => -//- from  to  min.
    [AM_12_15] => -//- from  to  min.
    [AM_15_18] => -//- from  to  min.
    [AM_18_21] => -//- from  to  min.
    [AM_21_24] => -//- from  to  min.
    [AM_24] => -//- over 24 min.
    [AH_AVERAGE_HITS] => average hits per session
    [AH_1] => number of sessions with only 1 hit
    [AH_2_5] => number of sessions with 2 to 5 hits
    [AH_6_9] => -//- 6 to 9 hits
    [AH_10_13] => -//- 10 to 13 hits
    [AH_14_17] => -//- 14 to 17 hits
    [AH_18_21] => -//- 18 to 21 hits
    [AH_22_25] => -//- 22 to 25 hits
    [AH_26_29] => -//- 26 to 29 hits
    [AH_30_33] => -//- 30 to 33 hits
    [AH_34] => -//-  over 34 hits
)

See Also

Example



<?
// select data for December 2005
$arFilter = array(
    "DATE1" => "01.12.2005",
    "DATE2" => "31.12.2005"
    );

// get traffic statistics
$rsDays = CTraffic::GetDailyList(
    ($by="s_date"), 
    ($order="desc"), 
    $arMaxMin, 
    $arFilter, 
    $is_filtered
    );

while ($arDay = $rsDays->Fetch())
{
    echo "date: ".$arDay["DATE_STAT"]."<br>";
    echo "hits: ".$arDay["HITS"]."<br>";
    echo "hosts: ".$arDay["C_HOSTS"]."<br>";
    echo "sessions: ".$arDay["SESSIONS"]."<br>";
    echo "events: ".$arDay["C_EVENTS"]."<br>";
    echo "visitors: ".$arDay["GUESTS"]."<br>";
}
?>