public function recognize(Pap_Contexts_Tracking $context) { if ($context->isVisitorAffiliateRecognized()) { return; } Pap_Tracking_Common_VisitorAffiliateCheckCompatibility::getHandlerInstance()->checkCompatibility($context->getVisitorId(), $this->visitorAffiliateCache); $context->debug('Getting VisitorAffiliate for visitorId = ' . $context->getVisitorId()); if (($visitorAffiliate = $this->visitorAffiliateCache->getActualVisitorAffiliate($context->getVisitorId())) == null) { $context->debug('Recognize VisitorAffiliate not recognized from actual'); return; } $context->debug('Recognize VisitorAffiliate recognized from actual, id: '.$visitorAffiliate->getId(). ', accountId: '. $visitorAffiliate->getAccountId()); $context->setVisitorAffiliate($visitorAffiliate); }
protected function createAndPrepareVisitorAffiliate(Pap_Contexts_Tracking $context) { $visitorAffiliate = $this->visitorAffiliateCache->createVisitorAffiliate($context->getVisitorId()); $this->prepareVisitorAffiliate($visitorAffiliate, $context); return $visitorAffiliate; }
private function getVisitorAffiliate(Pap_Db_VisitorAffiliate $firstClickVisitorAffiliate, Pap_Db_VisitorAffiliate $oldVisitorAffiliate = null, Pap_Tracking_Visit_VisitorAffiliateCache $cache, Pap_Contexts_Tracking $context) { if ($firstClickVisitorAffiliate->getDateVisit() > $context->getDateCreated()) { return $firstClickVisitorAffiliate; } if ($oldVisitorAffiliate == null) { $visitorAffiliate = $cache->createVisitorAffiliate($context->getVisitorId()); $visitorAffiliate->setDateVisit($context->getDateCreated()); return $visitorAffiliate; } if ($oldVisitorAffiliate->getDateVisit() < $context->getDateCreated()) { return $oldVisitorAffiliate; } return null; }