private function saveVisitor()
    {
        Yii::$app->session->set($this->visitorCookieName, $this->visitor->getPrimaryKey());

        if (!Yii::$app->request->cookies->has($this->visitorCookieName)) {
            $this->setVisitorCookie();
            return;
        }

        $cookie = Yii::$app->request->cookies->get($this->visitorCookieName);
        if ($cookie->expire - time() <= $this->visitorCookieExpireTime) {
            $this->setVisitorCookie();
        }
    }