Bitrix Site Manager

CReferer::GetList

CDBResult
CReferer::GetList(
 string &by = "s_id",
 string &order = "desc",
 array filter = array(),
 bool &is_filtered,
 int &total,
 string &group_by,
 int &max
)

The method GetList returns a list of referring pages.

Parameters

Parameter Description
by Sorting field. Depending on how the list is grouped, possible values of this parameters may vary.
  • grouping by referring page (filter["GROUP"]="U"):
    • s_url_from - referring page;
    • s_quantity - number of hits made from referring page;
    • s_average_hits - average number of hits made by visitors from a referring page.
  • grouping by referring domain (filter["GROUP"]="S"):
    • s_url_from - referring domain;
    • s_quantity - number of hits made from referring page;
    • s_average_hits - average number of hits made by visitors.
  • without grouping:
    • s_id - the record ID;
    • s_site_id - the ID of the target site;
    • s_url_from - referring page;
    • s_url_to - target page;
    • s_date_hit - date;
    • s_session_id - the session ID.
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:
  • ID - the record ID;
  • ID_EXACT_MATCH - if set to "N", the ID can be an entry in the identifier string (loose match);
  • SESSION_ID - the session ID;
  • SESSION_ID_EXACT_MATCH - if set to "N", the SESSION_ID can be an entry in the identifier string (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;
  • FROM_PROTOCOL - protocol of the referring page;
  • FROM_PROTOCOL_EXACT_MATCH - if set to "Y", the FROM_PROTOCOL must match exactly;
  • FROM_DOMAIN - domain of the referring page;
  • FROM_DOMAIN_EXACT_MATCH - if set to "Y", the FROM_DOMAIN must match exactly;
  • FROM_PAGE - referring page;
  • FROM_PAGE_EXACT_MATCH - if set to "Y", the FROM_PAGE must match exactly;
  • FROM - protocol + domain + referring page;
  • FROM_EXACT_MATCH - if set to "Y", the FROM must match exactly;
  • TO* - target page;
  • TO_EXACT_MATCH - if set to "Y", the TO must match exactly;
  • TO_404 - indicates the error 404 occurred on the target page (Y|N);
  • SITE_ID - the ID of the target site;
  • GROUP - how the resulting list is grouped; possible values:
    • S - grouping by the referring domain (site);
    • U - grouping by the referring page.
* - complex logic allowed.
is_filtered If this variable contains "true" on return, the resulting list is filtered.
total Total number of hits from the referring pages.
group_by How the returned list is grouped. Possible values:
  • U - grouping by the referring page;
  • S - grouping by the referring domain.
max Number of hits from the most popular referring page.

Structure of the returned record

The structure of the returned record varies depending on the grouping.

See Also

Example



<?
// we want only hits from the "google" domains
// grouped by the referring domain
$arFilter = array(
    "FROM_DOMAIN"  => "google",
    "GROUP"        => "S"
    );

// obtain the list of records
$rs = CReferer::GetList(
    ($by = "s_url_from"), 
    ($order = "desc"), 
    $arFilter, 
    $is_filtered,
    $total,
    $group_by,
    $max
    );

// print all records
while ($ar = $rs->Fetch())
{
    echo "<pre>"; print_r($ar); echo "</pre>";    
}
?>