Bitrix Site Manager

CGuest::GetList

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

The method GetList returns a list of visitors.

Parameters

Parameter Description
by The field by which the returned list is to be sorted. The following values are possible:
  • s_id - the visitor ID;
  • s_events - total number of events generated by visitor;
  • s_sessions - total number of visitor sessions;
  • s_hits - total number of visitor hits;
  • s_first_site_id - the ID of the site of the first visit;
  • s_first_date - date and time of the first visit;
  • s_first_url_from - the page from which the visitor came for the first time;
  • s_first_url_to - the page to which the visitor came for the first time;
  • s_first_adv_id - the ID of advertising campaign of the first visit;
  • s_last_site_id - the ID of the site of the last visit;
  • s_last_date - date and time of the last visit;
  • s_last_user_id - the user ID;
  • s_last_url_last - URL of the last page;
  • s_last_user_agent - the last UserAgent of the visitor;
  • s_last_ip - the visitor IP address of the last session;
  • s_last_adv_id - the advertising campaign ID of the last visit;
  • s_last_country_id - the ID of the country during the last visit.
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 visitor ID;
  • ID_EXACT_MATCH - if "N", entry in the ID is sufficient (loose match);
  • REGISTERED - whether the visitor was ever authorised on the site (Y|N);
  • FIRST_DATE1 - minimum value of the range "date of the first visit";
  • FIRST_DATE2 - maximum value of the range "date of the first visit";
  • LAST_DATE1 - minimum value of the range "date of the last visit";
  • LAST_DATE2 - maximum value of the range "date of the last visit";
  • PERIOD_DATE1 - minimum value of the range of the visit date;
  • PERIOD_DATE2 - maximum value of the range of the visit date;
  • SITE_ID* - the ID of the site of the first or last visit;
  • SITE_ID_EXACT_MATCH - if "N", entry in the SITE_ID is sufficient (loose match);
  • FIRST_SITE_ID* - the ID of the site of the first visit;
  • FIRST_SITE_ID_EXACT_MATCH - if "N", entry in the FIRST_SITE_ID is sufficient (loose match);
  • LAST_SITE_ID* - the ID of the site of the last visit;
  • LAST_SITE_ID_EXACT_MATCH - if "N", entry in the LAST_SITE_ID is sufficient (loose match);
  • URL* - pages: from or to which the visitor came for the first time; and the last viewed page;
  • URL_EXACT_MATCH - if "Y", the URL must match exactly (strict match);
  • URL_404 - whether the error 404 occurred at the first or last page: Y|N;
  • USER_AGENT* - the visitor UserAgent during the last visit;
  • USER_AGENT_EXACT_MATCH - if "Y", the USER_AGENT must match exactly (strict match);
  • ADV - whether the visitor ever came under the advertising campaign (which is not NA/NA), possible values:
    • Y - the visitor came at least once under known advertising campaign;
    • N - the visitor never came under known advertising campaign.
  • ADV_ID - the ID of the advertising campaign of the first or last visit (can be both direct hit and return);
  • REFERER1* - the identifier referer1 of the advertising campaign of the first or last visit;
  • REFERER1_EXACT_MATCH - if "Y", the REFERER1 must match exactly (strict match);
  • REFERER2* - the identifier referer2 of the advertising campaign of the first or last visit;
  • REFERER2_EXACT_MATCH - if "Y", the REFERER2 must match exactly (strict match);
  • REFERER3* - the auxiliary parameter referer3 of the advertising campaign of the first or last visit;
  • REFERER3_EXACT_MATCH - if "Y", the REFERER3 must match exactly (strict match);
  • EVENTS1 - minimum number of the visitor generated events;
  • EVENTS2 - maximum number of the visitor generated events;
  • SESS1 - minimum number of the visitor generated sessions;
  • SESS2 - maximum number of the visitor generated sessions;
  • HITS1 - minimum number of the visitor generated hits;
  • HITS2 - maximum number of the visitor generated hits;
  • FAVORITES - whether the visitor added the site to Favorites (Y|N);
  • IP - the visitor IP during the last session;
  • LANG - the visitor browser languages of the last session;
  • COUNTRY_ID* - the ID of the country during the last visit;
  • 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);
  • USER* - ID, login, first/last names of a user under which the visitor was last authorised;
  • USER_EXACT_MATCH - if "Y", the USER must match exactly (strict match);
  • USER_ID* - the user ID under which the visitor was last authorised;
  • USER_ID_EXACT_MATCH - if "Y", the USER_ID must match exactly (strict 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 visitor ID
    [FAVORITES] => [Y|N] means the site was added to Favorites
    [C_EVENTS] => number of events generated by this visitor
    [SESSIONS] => number of sessions of this visitor
    [HITS] => number of hits of this visitor
    [FIRST_SESSION_ID] => the ID of the first session
    [FIRST_DATE] => date and time of the first session
    [FIRST_URL_FROM] => URL of the page from which the visitor came for the first time
    [FIRST_URL_TO] => URL of the site page to which the visitor came for the first time
    [FIRST_URL_TO_404] => indicates the error 404 occurred on the page of the first visit
    [FIRST_SITE_ID] => the ID of the site of the first visit
    [FIRST_ADV_ID] => the ID of the advertising campaign under which the visitor came for the first time
    [FIRST_REFERER1] => the referer1 identifier of the advertising campaign FIRST_ADV_ID
    [FIRST_REFERER2] => the referer2 identifier of the advertising campaign FIRST_ADV_ID
    [FIRST_REFERER3] => the auxiliary parameter referer3 of the advertising campaign FIRST_ADV_ID
    [LAST_SESSION_ID] => the ID of the last session
    [LAST_DATE] => date and time of the last visit
    [LAST_USER_ID] => the user ID
    [LAST_USER_AUTH] => [Y|N] means the visitor was (or was not) authorised during the last session
    [LAST_URL_LAST] => URL of the last page
    [LAST_URL_LAST_404] => indicated the error 404 occurred at the last page
    [LAST_USER_AGENT] => the last UserAgent of the visitor
    [LAST_IP] => the visitor IP address of the last session
    [LAST_LANGUAGE] => the visitor browser languages of the last session
    [LAST_ADV_ID] => the advertising campaign ID of the last visit
    [LAST_ADV_BACK] => [Y|N]: Y - return, N - direct hit under the adv. campaign LAST_ADV_ID
    [LAST_REFERER1] => the identifier referer1 of the advertising campaign LAST_ADV_ID
    [LAST_REFERER2] => the identifier referer2 of the advertising campaign LAST_ADV_ID
    [LAST_REFERER3] => the auxiliary parameter referer3 of the advertising campaign LAST_ADV_ID
    [LAST_SITE_ID] => the ID of the last site
    [LAST_COUNTRY_ID] => the ID of the country during the last visit
    [LAST_COUNTRY_NAME] => the name of the country during the last visit
                           (if filter["COUNTRY_ID"] is set)
)

See Also

Example



<?
// select visitors with UserAgent == "Opera"
$arFilter = array(
    "USER_AGENT" => "Opera"
    );

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

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