Bitrix Site Manager

CHit::GetList

CDBResult
CHit::GetList(
 string &by = "s_id",
 string &order = "desc",
 array filter = array(),
 bool &is_filtered
)

The method GetList returns a list of visitor hits.

Parameters

Parameter Description
by The field by which the returned list is to be sorted. The following values are possible:
  • s_id - the hit ID;
  • s_site_id - the site ID;
  • s_session_id - the session ID;
  • s_date_hit - date ant time when the hit occurred;
  • s_user_id - the ID of a user under which the visitor was authorised (at the time of hit or before);
  • s_guest_id - the visitor ID;
  • s_ip - the IP address of the visitor;
  • s_url - the page where the hit occurred;
  • s_country_id - the ID of the visitor country.
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 hit ID;
  • ID_EXACT_MATCH - if "N", entry in the ID is sufficient (loose match);
  • GUEST_ID* - the visitor ID;
  • GUEST_ID_EXACT_MATCH - if "N", entry in the GUEST_ID is sufficient (loose match);
  • NEW_GUEST - the "new visitor" flag; possible values:
    • Y - first time visitor (in the scope of the portal);
    • N - old visitor.
  • SESSION_ID* - the session ID;
  • SESSION_ID_EXACT_MATCH - if "N", entry in the SESSION_ID is sufficient (loose match);
  • STOP_LIST_ID* - the ID of the stop list record for the visitor (if applicable);
  • STOP_LIST_ID_EXACT_MATCH - if "N", entry in the SESSION_ID is sufficient (loose match);
  • URL* - the page where the hit occurred;
  • URL_EXACT_MATCH - if "Y", the USER_AGENT must match exactly (strict match);
  • URL_404 - whether the error 404 occurred on the hit page (Y|N);
  • USER* - ID, login, first/last names of a user under which the visitor was authorised (at the time of hit or before);
  • USER_EXACT_MATCH - if "Y", the USER_AGENT must match exactly (strict match);
  • REGISTERED - whether the visitor was authorised on the site at the time of hit or before (Y|N);
  • DATE_1 - first value of the hit generation time range (time from which the hit could be generated);
  • DATE_2 - last value of the hit generation time range (time till which the hit could be generated);
  • IP* - the visitor IP address at the time of hit;
  • IP_EXACT_MATCH - if "Y", the IP must match exactly (strict match);
  • USER_AGENT* - the visitor UserAgent at the time of hit;
  • USER_AGENT_EXACT_MATCH - if "Y", the USER_AGENT must match exactly (strict match);
  • COUNTRY_ID* - the visitor country ID at the time of hit;
  • COUNTRY_ID_EXACT_MATCH - if "Y", the COUNTRY_ID must match exactly (strict match);
  • COUNTRY* - name of the country;
  • COUNTRY_EXACT_MATCH - if "Y", the COUNTRY must match exactly (strict match);
  • COOKIE* - Cookie contents at the time of hit;
  • COOKIE_EXACT_MATCH - if "Y", the COOKIE must match exactly (strict match);
  • STOP - the visitor was added to the stop list (Y|N);
  • 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.

Structure of the returned record

Array
(
    [ID] => the hit ID
    [SESSION_ID] => the session ID
    [DATE_HIT] => date and time of the hit
    [GUEST_ID] => the visitor ID
    [NEW_GUEST] => [Y|N] flag "new visitor" (Y)
    [USER_ID] => the ID of a user under which the visitor was authorised (at the time of hit or before)
    [USER_AUTH] => [Y|N] flag indicating the visitor was authorised at the time of hit
    [URL] => hit page
    [URL_404] => whether the error 404 occurred on the hit page
    [URL_FROM] => URL from which the visitor came
    [IP] => the IP address of the visitor at the time of hit
    [METHOD] => the HTTP request method
    [COOKIES] => contents of visitor's Cookie at the time of hit
    [USER_AGENT] => the visitor's UserAgent at the time of hit
    [STOP_LIST_ID] => the ID of the stop list record for the visitor(if applicable)
    [COUNTRY_ID] => the country ID (two-character identifier) of the visitor at the time of hit (defined by the IP address)
    [COUNTRY_NAME] => name of the visitor country at the time of hit (defined by the IP address)
    [SITE_ID] => the site ID (two-character identifier)
    [LOGIN] => the user login under which the visitor was authorised (at the time of hit or before)
    [USER_NAME] => first and last names of a user under which the visitor was authorised (at the time of hit or before)
)

See Also

Example



<?
// select hits of session #1056
$arFilter = array(
    "SESSION_ID" => 1056
    );

// obtain the list of records
$rs = CHit::GetList(
    ($by = "s_id"), 
    ($order = "desc"), 
    $arFilter, 
    $is_filtered
    );

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