Bitrix Site Manager

CGuest::GetByID

CDBResult
CGuest::GetByID(
 int guest_id
)

The method GetByID returns information on the specified visitor.

Parameters

Parameter Description
guest_id The visitor ID.

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
    [REPAIR] => [Y|N] means the visitor was "restored" after the data clean-up (Y)
    [FIRST_SESSION_ID] => the ID of the first session
    [FSESSION_TIME] => duration of the first session (sec.)
    [FSESSION_HITS] => number of hits within 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
    [LSESSION_TIME] => length of the last session (sec.)
    [LSESSION_HITS] => number of hits of the last session
    [LAST_DATE] => date and time of the last visit
    [LAST_USER_ID] => the user ID
    [USER_NAME] => first and last names of a user under which the visitor was last authorised
    [LOGIN] => login of a user under which the visitor was last authorised
    [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_COOKIE] => the visitor Cookie 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
    [COUNTRY_NAME] => the name of the country during the last visit
)

See Also

Example



<?
$guest_id = 1;
if ($rs = CGuest::GetByID($guest_id))
{
    $ar = $rs->Fetch();
    // print the visitor parameters
    echo "<pre>"; print_r($ar); echo "</pre>";
}
?>