Returns the ID of a visitor that is adjacent to another visitor (by time of last action)
in the log_visit table.
public queryAdjacentVisitorId ( integer $idSite, string $visitorId, string $visitLastActionTime, string $segment, boolean $getNext ) : string | ||
$idSite | integer | The ID of the site whose visits should be looked at. |
$visitorId | string | The ID of the visitor to get an adjacent visitor for. |
$visitLastActionTime | string | The last action time of the latest visit for $visitorId. |
$segment | string | |
$getNext | boolean | Whether to retrieve the next visitor or the previous visitor. The next visitor will be the visitor that appears chronologically later in the log_visit table. The previous visitor will be the visitor that appears earlier. |
return | string | The hex visitor ID. |
/** * @param DataTable $visits * @param $visitorId * @param $segment */ private function handleAdjacentVisitorIds(DataTable $visits, $visitorId, $segment) { // get visitor IDs that are adjacent to this one in log_visit // TODO: make sure order of visitor ids is not changed if a returning visitor visits while the user is // looking at the popup. $rows = $visits->getRows(); $latestVisitTime = reset($rows)->getColumn('lastActionDateTime'); $model = new Model(); $this->profile['nextVisitorId'] = $model->queryAdjacentVisitorId($this->idSite, $visitorId, $latestVisitTime, $segment, $getNext = true); $this->profile['previousVisitorId'] = $model->queryAdjacentVisitorId($this->idSite, $visitorId, $latestVisitTime, $segment, $getNext = false); }