request = $request; $this->moduleManager = $moduleManager; $this->cacheConfig = $cacheConfig; } /** * Check if depersonalize or not * * @param \Magento\Framework\View\LayoutInterface $subject * @return bool * @api */ public function checkIfDepersonalize(\Magento\Framework\View\LayoutInterface $subject) { return ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && ($this->request->isGet() || $this->request->isHead()) && $subject->isCacheable()); } }