Bitrix Site Manager

CTraffic::GetSumList

CDBResult
CTraffic::GetSumList(
 string data_type,
 array filter = array(),
)

The method GetSumList returns the number of hits, hosts, sessions, visitors, events on hourly, daily or monthly basis.

Parameters

Parameter Description
data_type Data type. Possible values:
  • hour - return data on hourly basis;
  • weekday - on daily basis;
  • month - on monthly basis.
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.

Structure of the returned record

The structure of the returned record varies depending on the data_type parameter value.

See Also

Example



<?
// obtain information on daily traffic
$rs = CTraffic::GetSumList("weekday");
$ar = $rs->Fetch();
for ($i=0; $i<=6; $i++)
{
    switch($i)
    {
        case 0: echo "sun"; break;
        case 1: echo "mon"; break;
        case 2: echo "tue"; break;
        case 3: echo "wed"; break;
        case 4: echo "thu"; break;
        case 5: echo "fri"; break;
        case 6: echo "sat"; break;
    }
    echo "<br>";
    echo "hosts: ".$ar["WEEKDAY_HOST_".$i]."<br>";
    echo "sessions: ".$ar["WEEKDAY_SESSION_".$i]."<br>";
    echo "hits: ".$ar["WEEKDAY_HIT_".$i]."<br>";
    echo "visitors: ".$ar["WEEKDAY_GUEST_".$i]."<br>";
    echo "new visitors: ".$ar["WEEKDAY_NEW_GUEST_".$i]."<br>";
    echo "<br><br>";
}
?>