74 private $requestSafety;
101 \
Magento\Framework\Data\Collection\AbstractDb $resourceCollection =
null,
126 $userAgent = $this->httpHeader->getHttpUserAgent();
127 if ($this->ignoredUserAgents) {
128 if (in_array($userAgent, $this->ignoredUserAgents)) {
129 $this->skipRequestLogging =
true;
160 if ($this->session->getVisitorData()) {
161 $this->
setData($this->session->getVisitorData());
162 if ($this->getSessionId() != $this->session->getSessionId()) {
163 $this->setSessionId($this->session->getSessionId());
170 if ($this->requestSafety->isSafeMethod()) {
173 if (!$this->
getId()) {
174 $this->setSessionId($this->session->getSessionId());
176 $this->_eventManager->dispatch(
'visitor_init', [
'visitor' => $this]);
177 $this->session->setVisitorData($this->
getData());
199 $this->_eventManager->dispatch(
'visitor_activity_save', [
'visitor' => $this]);
200 $this->session->setVisitorData($this->
getData());
201 }
catch (\Exception $e) {
202 $this->_logger->critical($e);
215 if (is_array($this->ignores) &&
$observer) {
216 $curModule =
$observer->getEvent()->getControllerAction()->getRequest()->getRouteName();
217 if (isset($this->ignores[$curModule])) {
232 public function bindCustomerLogin(
$observer)
236 if (!$this->getCustomerId()) {
237 $this->setDoCustomerLogin(
true);
238 $this->setCustomerId(
$customer->getId());
254 if ($this->getCustomerId()) {
255 $this->setDoCustomerLogout(
true);
270 if (
$quote->getIsCheckoutCart()) {
271 $this->setQuoteId(
$quote->getId());
272 $this->setDoQuoteCreate(
true);
287 $this->setDoQuoteDestroy(
true);
299 return $this->scopeConfig->getValue(
323 $configValue = intval(
324 $this->scopeConfig->getValue(
325 static::XML_PATH_ONLINE_INTERVAL,
329 return $configValue ?: static::DEFAULT_ONLINE_MINUTES_INTERVAL;
const DATETIME_PHP_FORMAT
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Session\SessionManagerInterface $session, \Magento\Framework\HTTP\Header $httpHeader, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $ignoredUserAgents=[], array $ignores=[], array $data=[], RequestSafetyInterface $requestSafety=null)
const VISITOR_TYPE_CUSTOMER
setData($key, $value=null)
getData($key='', $index=null)
bindQuoteDestroy($observer)
isModuleIgnored($observer)
const DEFAULT_ONLINE_MINUTES_INTERVAL
const VISITOR_TYPE_VISITOR
bindCustomerLogout($observer)
bindQuoteCreate($observer)
setSkipRequestLogging($skipRequestLogging)
const XML_PATH_ONLINE_INTERVAL