What is the _pk_ses cookie?
_pk_ses belongs to the family of cookies generated by Matomo, a web analytics tool that many organizations self-host or run via cloud as an alternative to Google Analytics. The cookie is set by the Matomo tracking script (matomo.js/piwik.js) directly from the visitor's browser, making it a first-party cookie issued by the visited site's own domain.
It appears as soon as a page containing the Matomo script loads and the visitor has consented to statistics cookies — or, in setups without properly implemented prior consent, on the first page load itself.
What data it stores
The cookie stores technical information about the current browsing session: a session identifier and markers that help Matomo recognize page views and actions (pages visited, clicks) as belonging to the same visit. The exact value format is specific to each Matomo installation and is not publicly documented in detail, so it varies from site to site.
Data collected through this cookie is sent to wherever Matomo is running — either the site's own server (self-hosted) or Matomo Cloud infrastructure, depending on how the tool was deployed.
What it is used for
Its main purpose is letting Matomo distinguish one "visit" (session) from another, so that analytics reports remain accurate: number of visits, average session duration, pages viewed within a single visit, and so on. Without this cookie, each page load could be counted as a separate visit, skewing the data.
For site owners, this information supports understanding visitor behavior, optimizing content, and measuring campaign effectiveness without relying on third-party services like Google.
Does it require consent?
Under CookieFix's classification, _pk_ses falls under the statistics (analytics) category. Under the ePrivacy Directive (transposed in Romania via Law 506/2004) and ANSPDCP's guidance, analytics cookies are not strictly necessary for the site to function, so they require prior user consent before being set — even when Matomo is self-hosted.
Site owners should: list the cookie in their cookie policy, avoid setting it before consent is obtained, and provide a clear way to opt out. Configuring Matomo with IP anonymization and no cross-site tracking can reduce risk, but does not remove the consent requirement for this cookie.
How to block or delete _pk_ses
- Visitors can delete or block _pk_ses through their browser's cookie settings (Chrome, Firefox, Edge, Safari), or use private/incognito browsing.
- Do Not Track settings or tracker-blocking extensions can prevent the Matomo script from running.
Site owners should automatically block the Matomo script until consent is given, using a CMP such as CookieFix, which stops the tracking script from loading before the visitor makes a choice and only activates it after consent for the statistics category.
Frequently asked questions
It's a session cookie set by Matomo to group a visitor's pages and actions within the same visit, for web analytics purposes.
The typical duration is 30 minutes from the last recorded action; if the visitor stays inactive longer, a new session starts on their return.
Yes, since it's a statistics cookie, it requires prior consent under ePrivacy and GDPR, regardless of whether Matomo runs self-hosted or in the cloud.
_pk_ses tracks the current session (30 minutes), while _pk_id is the persistent cookie that identifies a visitor over a longer period, across multiple visits.