Bitrix Site Manager

CTraffic::GetCommonValues

array
CTraffic::GetCommonValues(
 array filter = array()
)

The method GetCommonValues returns the number of hits, hosts, sessions, visitors, events: for the whole time of keeping statistics, for the last 3 days, or for the specified period.

Note
When filtering by site (filter[SITE_ID]), you can retrieve information only on hits, hosts, sessions, events. No information on visitors will be available since the current version of the module assumes a single visitor for the portal.

Parameters

Parameter Description
filter Array used to filter the resulting list. The following keys can be used in the array:
  • SITE_ID - the ID of the site whose statistics is to be obtained;
  • DATE1 - starting date;
  • DATE2 - ending date.

Return Values

If filtering by site, the format of a returned array is the following:

Array
(
    [TOTAL_HITS] => total number of hits (for the whole period of keeping statistics)
    [TOTAL_SESSIONS] => total number of sessions (-//-)
    [TOTAL_EVENTS] => total number of events (-//-)
    [TOTAL_HOSTS] => total number of hosts (-//-)
    [TOTAL_GUESTS] => total number of visitors (-//-)
    [TOTAL_FAVORITES] => total number of visitors who added to Favorites (-//-)

    [TODAY_HITS] => today's hits
    [TODAY_SESSIONS] => today's sessions
    [TODAY_EVENTS] => today's events
    [TODAY_HOSTS] => today's hosts
    [TODAY_GUESTS] => today's visitors
    [TODAY_NEW_GUESTS] => today's new visitors
    [TODAY_FAVORITES] => today's visitors who added to Favorites

    [YESTERDAY_HITS] => yesterday's hits
    [YESTERDAY_SESSIONS] => yesterday's sessions
    [YESTERDAY_EVENTS] => yesterday's events
    [YESTERDAY_HOSTS] => yesterday's hosts
    [YESTERDAY_GUESTS] => yesterday's visitors
    [YESTERDAY_NEW_GUESTS] => yesterday's new visitors
    [YESTERDAY_FAVORITES] => yesterday's visitors who added to Favorites

    [B_YESTERDAY_HITS] => number of hits for day before yesterday
    [B_YESTERDAY_SESSIONS] => number of sessions -//-
    [B_YESTERDAY_EVENTS] => number of events -//-
    [B_YESTERDAY_HOSTS] => number of hosts -//-
    [B_YESTERDAY_GUESTS] => number of visitors -//-
    [B_YESTERDAY_NEW_GUESTS] => number of new visitors -//-
    [B_YESTERDAY_FAVORITES] => number of visitors who added to Favorites -//-

    [PERIOD_HITS] => number of hits for the specified period
                     (filter[DATE1], filter[DATE2])
    [PERIOD_SESSIONS] => number of sessions -//-
    [PERIOD_EVENTS] => number of events -//-
    [PERIOD_NEW_GUESTS] => number of visitors -//-
    [PERIOD_FAVORITES] => number of visitors who added to Favorites -//-

    [ONLINE_GUESTS] => number of online visitors
)

See Also

Example



<?
// obtain traffic information
$arr = CTraffic::GetCommonValues();

echo "total hits: ".$arr["TOTAL_HITS"];
echo "today's hits: ".$arr["TODAY_HITS"];

echo "total hosts: ".$arr["TOTAL_HOSTS"];
echo "today's hosts: ".$arr["TODAY_HOSTS"];

echo "total visitors: ".$arr["TOTAL_GUESTS"];
echo "today's visitors: ".$arr["TODAY_GUESTS"];
echo "on-line visitors: ".$arr["ONLINE_GUESTS"];
?>