Log in
Model

Visitor

Magento\Customer\Model\Visitor

What it does

The Visitor model tracks and manages visitor sessions in Magento 2, recording customer activity and distinguishing between logged-in customers and anonymous visitors.

Developers use this class to monitor user sessions, bind customer login/logout events, track quote creation/destruction, and maintain online customer data for analytics and reporting purposes.

It automatically logs visitor information during requests and provides methods to clean outdated visitor records.

Public Methods

  • setSkipRequestLogging()
  • initByRequest()
  • beforeSave()
  • afterSave()
  • saveByRequest()
  • isModuleIgnored()
  • bindCustomerLogin()
  • bindCustomerLogout()
  • bindQuoteCreate()
  • bindQuoteDestroy()
  • getCleanTime()
  • clean()
  • getOnlineInterval()