public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $cookieNames = $this->getCookies();

        $metadata = $this->cookieMetadataFactory->createPublicCookieMetadata();
        $metadata->setPath($this->getCookieConfiguration()['path'] ?? '/');

        foreach ($cookieNames as $cookieName) {
            $this->cookieManager->deleteCookie($cookieName, $metadata);
        }
    }
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $cookieNames = $this->getCookies();

        $metadata = $this->cookieMetadataFactory->createPublicCookieMetadata();
        $metadata->setPath($this->getCookieConfiguration()['path'] ?? '/');

        foreach ($cookieNames as $cookieName) {
            $this->cookieManager->deleteCookie($cookieName, $metadata);
        }
    }
public function execute ( \ Magento \ Framework \ Event \ Observer $ observer ) { $ cookieNames = $ this -> getCookies ( ) ; $ metadata = $ this -> cookieMetadataFactory -> createPublicCookieMetadata ( ) ; $ metadata -> setPath ( $ this -> getCookieConfiguration ( ) [ 'path' ] ?? '/' ) ; foreach ( $ cookieNames as $ cookieName ) { $ this -> cookieManager -> deleteCookie ( $ cookieName , $ metadata ) ; } }
Clean customer tracking cookies when logging out.

@SuppressWarnings(PHPMD.UnusedFormalParameter)

@event customer_logout

@param \Magento\Framework\Event\Observer $observer The observer

@return void
Clean customer tracking cookies when logging out .