arunzer
(André Runzer)
April 23, 2020, 10:16am
1
My question regards Matomo Version 3.13.4.
The names of the cookies that are being set seem to differ somewhat from what is specified on this
page .
Examples in Firefox 75 (MacOS):
_pk_id.1.1c47
_pk_ses.1.1c47
Where does the suffix part come from and what does it mean? For compliance with European privacy laws we have to accurately describe all cookies used by a website which is sort of problematic since the cookie names in our Matomo installation seem to be dynamic. Any clarification on that is much appreciated.
Have a nice day and be safe.
André Runzer
Lukas
(Lukas Winkler)
April 23, 2020, 11:17am
2
Hi,
The only place that can tell you this for sure is the source of matomo.js:
/*
* Get cookie name with prefix and domain hash
*/
function getCookieName(baseName) {
// NOTE: If the cookie name is changed, we must also update the PiwikTracker.php which
// will attempt to discover first party cookies. eg. See the PHP Client method getVisitorId()
return configCookieNamePrefix + baseName + '.' + configTrackerSiteId + '.' + domainHash;
}
So _pk
is the prefix (that is always set to _pk
), the next part is the name of the cookie, then the siteID and then the domainHash
.
This brings us to the question: What is the domainHash
?
It is the first 4 characters of the hash of the domains the cookie is set to.
And the last question is answered here:
lastTrackerRequestTime = null,
// Handle to the current heart beat timeout
heartBeatTimeout,
// Internal state of the pseudo click handler
lastButton,
lastTarget,
// Hash function
hash = sha1,
// Domain hash value
domainHash,
configIdPageView,
// we measure how many pageviews have been tracked so plugins can use it to eg detect if a
// pageview was already tracked or not
numTrackedPageviews = 0,
hash
is simply an alias for the sha1
hash algorithm.
So I hope this explains why the cookies are called like that.
1 Like