private function addCustomerLink($eventData)
    {
        // The customerId is set in session if the Magento_Persistent module is enabled and a persistent session exists.
        if ($this->customerSession->getCustomerId() !== null) {
            $customerId = $this->customerSession->getCustomerId();
            $sessionId  = $eventData['session']['uid'] ?? null;
            $visitorId  = $eventData['session']['vid'] ?? null;

            if ($sessionId && $visitorId) {
                $data = [
                    'customer_id' => $customerId,
                    'session_id'  => $sessionId,
                    'visitor_id'  => $visitorId,
                ];

                if ($this->helper->isAnonymizationEnabled()) {
                    $date = new \DateTime();
                    $date->modify(sprintf('+ %d days', $this->helper->getAnonymizationDelay()));
                    $data['delete_after'] = $date;
                }

                $this->customerLinkResource->saveLink($data);
            }
        }
    }