I would like to use Matomo for very, very simple tracking. I would like to do without JS. I would like to do HTTP tracking via MatomoTracker.php. Is there a possibility to disable all cookies completely in PHP?
1 Like
Anyone?
I only found a setting for Third-party-cookies.
I want to use a server-sided solution without cookies. So no js and no images.
Is it possible to use Matomo PHP tracker without any cookies?
Lukas
(Lukas Winkler)
May 17, 2020, 6:50pm
5
Hi,
Disclaimer: I know very little about the php-tracker.
But looking at the code shouldn’t this be a matter of just not calling enableCookies()
or setFirstPartyCookies
?
/**
* Enable Cookie Creation - this will cause a first party VisitorId cookie to be set when the VisitorId is set or reset
*
* @param string $domain (optional) Set first-party cookie domain.
* Accepted values: example.com, *.example.com (same as .example.com) or subdomain.example.com
* @param string $path (optional) Set first-party cookie path
*/
public function enableCookies($domain = '', $path = '/')
{
$this->configCookiesDisabled = false;
$this->configCookieDomain = self::domainFixup($domain);
$this->configCookiePath = $path;
}
/**
* Sets the first party cookies as would the matomo.js
* All cookies are supported: 'id' and 'ses' and 'ref' and 'cvar' cookies.
* @return $this
*/
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);
}
This file has been truncated. show original
Those are the only occurences of setCookie
I can see.
Lukas:
setFirstPartyCookies
Thanks a lot! I will try it
Julius35
(Lars Göhler)
March 22, 2021, 7:12am
7
The best server-sided solution without cookies and tracking code might be the log file analysis:
https://matomo.org/docs/log-analytics-tool-how-to/