public function init($siteId = '', $force = false)
    {
        $siteId = !empty($siteId) ? $siteId : $this->payload->getSiteId();
        $hasUserId = $this->cookie->getCookie(CookieNames::USER_ID);
        $hasUserId = !empty($hasUserId);

        //store siteId on cookies
        $this->cookie->setCookie(CookieNames::SITE_ID, $siteId);

        //store campaignId on cookies
        $this->storeCampaignIdIfExists();
        if (!$hasUserId || $force) {
            $newUserId = $this->replace_dashes(Uuid::v4());
            $this->cookie->setCookie(CookieNames::USER_ID, $newUserId, time() + 60 * 60 * 24 * 3650);
            return;
        }
    }
public function init($siteId = '', $force = false)
    {
        $siteId = !empty($siteId) ? $siteId : $this->payload->getSiteId();
        $hasUserId = $this->cookie->getCookie(CookieNames::USER_ID);
        $hasUserId = !empty($hasUserId);

        //store siteId on cookies
        $this->cookie->setCookie(CookieNames::SITE_ID, $siteId);

        //store campaignId on cookies
        $this->storeCampaignIdIfExists();
        if (!$hasUserId || $force) {
            $newUserId = $this->replace_dashes(Uuid::v4());
            $this->cookie->setCookie(CookieNames::USER_ID, $newUserId, time() + 60 * 60 * 24 * 3650);
            return;
        }
    }
public function init ( $ siteId = '' , $ force = false ) { $ siteId = ! empty ( $ siteId ) ? $ siteId : $ this -> payload -> getSiteId ( ) ; $ hasUserId = $ this -> cookie -> getCookie ( CookieNames :: USER_ID ) ; $ hasUserId = ! empty ( $ hasUserId ) ; //store siteId on cookies $ this -> cookie -> setCookie ( CookieNames :: SITE_ID , $ siteId ) ; //store campaignId on cookies $ this -> storeCampaignIdIfExists ( ) ; if ( ! $ hasUserId || $ force ) { $ newUserId = $ this -> replace_dashes ( Uuid :: v4 ( ) ) ; $ this -> cookie -> setCookie ( CookieNames :: USER_ID , $ newUserId , time ( ) + 60 * 60 * 24 * 3650 ) ; return ; } }
Stores a cookie that tells if a user is a new one or returned

@param string $siteId
@param bool $force
Stores a cookie that tells if a user is a new one or returned