PiwikTracker::setFirstPartyCookies PHP Method

setFirstPartyCookies() protected method

Sets the first party cookies as would the piwik.js All cookies are supported: 'id' and 'ses' and 'ref' and 'cvar' cookies.
protected setFirstPartyCookies ( )
    protected function setFirstPartyCookies()
    {
        if ($this->configCookiesDisabled) {
            return $this;
        }
        if (empty($this->cookieVisitorId)) {
            $this->loadVisitorIdCookie();
        }
        // Set the 'ref' cookie
        $attributionInfo = $this->getAttributionInfo();
        if (!empty($attributionInfo)) {
            $this->setCookie('ref', $attributionInfo, $this->configReferralCookieTimeout);
        }
        // Set the 'ses' cookie
        $this->setCookie('ses', '*', $this->configSessionCookieTimeout);
        // Set the 'id' cookie
        $visitCount = $this->visitCount + 1;
        $cookieValue = $this->getVisitorId() . '.' . $this->createTs . '.' . $visitCount . '.' . $this->currentTs . '.' . $this->lastVisitTs . '.' . $this->ecommerceLastOrderTimestamp;
        $this->setCookie('id', $cookieValue, $this->configVisitorCookieTimeout);
        // Set the 'cvar' cookie
        $this->setCookie('cvar', json_encode($this->visitorCustomVar), $this->configSessionCookieTimeout);
        return $this;
    }