Bitrix Site Manager

CTraffic::GetRefererList

CDBResult
CTraffic::GetRefererList(
 string &by = "ref_today",
 string &order = "desc",
 array filter = array(),
 bool &is_filtered,
 mixed limit = 10,
)

The method GetRefererList returns the number of referring sites: for the whole time of keeping statistics, for the last 3 days, or for the specified period.

Parameters

Parameter Description
by Sorting field; possible values:
  • ref_server - the referring site;
  • ref_today - number of today's visits from the referring site;
  • ref_yesterday - number of yesterday's visits from the referring site;
  • ref_bef_yesterday - number of visits from the referring site for day before yesterday;
  • ref_total - total number of visits from the referring site;
  • ref_period - number of visits from the referring site for the period (filter[DATE1], filter[DATE2]).
order Sort order; the following values are possible:
  • asc - ascending;
  • desc - descending.
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 referring site statistics is to be obtained;;
  • DATE1 - starting date;
  • DATE2 - ending date.
is_filtered If this variable contains "true" on return, the resulting list is filtered.
limit Maximum number of records to return. If set to 0, the number of returned records is not limited.

Structure of the returned record

Array
(
    [SITE_NAME] => the referring site
    [TOTAL_REFERERS] => total number of visits from the referring site
    [TODAY_REFERERS] => number of today's visits from the referring site
    [YESTERDAY_REFERERS] => number of yesterday's visits from
                            the referring site
    [B_YESTERDAY_REFERERS] => number of visits from the referring site
                              for day before yesterday
    [PERIOD_REFERERS] => number of visits from the referring site
                         for the period 
                         (filter[DATE1],  filter[DATE2])
)

See Also

Example



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

// obtain the list of phrases and the statistics
$rs = CTraffic::GetRefererList(
    ($by="ref_today"), 
    ($order="desc"), 
    $arFilter, 
    $is_filtered, 
    false
    );

while ($ar = $rs->Fetch())
{
    echo "referring site: ".$ar["SITE_NAME"]."<br>";
    echo "total hits from this site: ".
         $ar["TOTAL_REFERERS"]."<br>";
    echo "today: ".$ar["TODAY_REFERERS"]."<br>";
    echo "yesterday: ".$ar["YESTERDAY_REFERERS"]."<br>";
    echo "day before yesterday: ".$ar["B_YESTERDAY_REFERERS"]."<br>";
    echo "during December 2005: ".
         $ar["PERIOD_REFERERS"]."<br>";
}
?>