How do I enable third party tracking cookies, as well as the existing first party cookies?
For Privacy reasons, Matomo does not use 3rd party cookies by default (only first party cookies, which can be easily disabled).
In some cases, it might be interesting to enable third party cookies, so that a same visitor will get the same ID across all your domains and subdomains. Matomo (Piwik) doesn’t report cross sites visits at this stage, so you will benefit from using third party cookies only if you run manual queries against Matomo database. To enable 3rd party cookies, edit your config/config.ini.php and add the following lines:
[Tracker]
use_third_party_id_cookie = 1
When this is enabled, Matomo tracker will serve a third party cookie containing an id visitor (16 chars ID). This ID will be the same for this visitor across all websites, and is stored in the database field log_visit.idvisitor
.
You can also configure this setting on a per site basis.
Enabling third party cookies would typically require user consent.
See also: How does Matomo detect unique and returning visitors? (with User ID, Visitor ID from cookie)