Skip to content

Document Hybrid Tracking (consent-aware analytics) - #990

Open
nathangavin wants to merge 2 commits into
livefrom
dev-21040-hybrid-tracking
Open

nathangavin wants to merge 2 commits into
livefrom
dev-21040-hybrid-tracking

Conversation

@nathangavin

Copy link
Copy Markdown

Description

Documents Hybrid Tracking (consent-aware analytics), added by matomo-org/matomo#25719. A website measuring under a compliance exemption can measure every visitor from the first page view, and also collect campaign values, full referrers and User ID for visitors who give consent.

  • New guide tracking-consent-hybrid.md, listed under Tracking after Tracking & Cookie Consent:
    • when it applies: a compliance policy is enforced, the website is opted in, and the tracker reports consent
    • requireConsentForRestrictedData(), a full tracking snippet and the Tag Manager option
    • reporting consent with setConsentGiven() / rememberConsentGiven() and the mtm_measurement_consent cookie, and the signals that don't count as consent (cookie consent, mtm_consent)
    • withdrawal (forgetConsentGiven()) compared with opt-out (optUserOut(), forgetUserOptOut())
    • the consent HTTP API parameter
    • what happens when consent arrives part way through a visit
    • log_visit.consent and the consentState segment
    • known limitations and the server-side APIs for plugin developers
  • tracking-consent.md: Hybrid Tracking added as a third consent option, linking to the guide.
  • tracking-javascript.md: adds requireConsentForRestrictedData() and isRestrictedDataConsentRequired(), and how setConsentGiven(), rememberConsentGiven() and forgetConsentGiven() behave when it is used.
  • tracking-api.md: the consent parameter.
  • database-schema.md: the log_visit.consent column.

Opened as a draft. Merge after matomo-org/matomo#25719. Before merging, check these against the code as it is released:

Checklist

  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules

Review

🤖 Generated with Claude Code

Add a guide for measuring visitors who give consent without the
restrictions a compliance policy applies, and reference the new
tracker method, HTTP API parameter and log_visit column from the
existing tracking, JavaScript and database schema pages.

Co-Authored-By: Claude <noreply@anthropic.com>
@tzi
tzi marked this pull request as ready for review November 23, 2026 21:51
@tzi
tzi requested a review from a team November 23, 2026 21:52
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved

@tzi tzi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hybrid Tracking will be completed by several follow-up PRs: the IP address (matomo-org/matomo#25759), the device model and versions (#25754), the screen resolution (#25768), the order ID (#25767), the PII URL parameters (#25777) and the third-party cookie (#25782).

Each of them will change this guide: the data listed in the introduction and in the "released in stages" note, "Known limitations", and for some "When consent arrives part way through a visit" (#25777 changes the visit split) and "For plugin developers" (#25759 changes Tracker.setVisitorIp). Could each follow-up PR come with its own update to this guide, so the guide always matches what is released?

Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Comment thread docs/6.x/tracking-consent-hybrid.md Resolved
Thirteen corrections from review, taken as written:

- the setting now lives on Privacy > Compliance and applies per website or to
  all websites, so the setup steps and the prerequisites were out of date
- requireConsentForRestrictedData() changes what the tracker does; it is not
  what makes the server honour consent, so a page using requireConsent() is
  measured as consenting too
- getConfiguredValue() only answers for the PrivacyManager settings on its
  allowlist and throws for anything else, which a plugin cannot extend
- setConsentGiven() and rememberConsentGiven() turn cookies back on after
  disableCookies(), which the cookies paragraph had backwards
- consent is recorded on the visit, so later requests of the same visit count
  without repeating the parameter
- forgetConsentGiven() also clears mtm_consent, and takes cookies away only
  where no separate cookie consent was given
- where to find consented visits in the Visits Log and the GDPR tools
- the remembered-consent cookie expires after 30 years rather than never
- turning the setting off changes later requests only, not stored data
- a withdrawal in another window stops that window only where it had read the
  consent from the cookie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants