Repository navigation
TIGER-306: Matomo tracking adapter (first-party analytics + affiliate attribution) - #338
Merged
Merged
Conversation
…ics + affiliate attribution)
A new `matomo` module, sibling to `analytics` (GA4): a config-backed, consent-gated
self-hosted Matomo tracker that also reads the `/a/<name>` affiliate cookie into a Matomo
visit-scoped custom dimension so visits + conversions are segmentable by affiliate.
- Registers `matomo` in `Tiger_Tracking` (category analytics; coexists with ga4).
- `Matomo_Plugin_Tag` emits the `_paq` snippet into the `tigerTracking` head placeholder,
gated by `Tiger_Consent::allows('analytics')`, staff-excludable, fail-open. Auto-assigns
its front-controller stackIndex (analytics owns 92 — a duplicate index is fatal at boot).
- Affiliate: reads the `tiger_aff` contract cookie, validates the name, and pushes
`setCustomDimension(<index>, <name>)` before trackPageView. This module READS the cookie;
TigerAffiliates (TIGER-303) WRITES it and owns the `/a/<name>` route.
- Admin Settings screen (`/matomo/admin`, admin-only) + `/api` save to the config tier
(url, site_id, affiliate dimension index, enabled, exclude-signed-in). 7 locales.
- Tests: 14 integration tests (plugin snippet/gating/affiliate-dimension/latch + controller).
Proven live on tiger-dev against the dev Matomo (analytics-dev.webtigers.com): guest pages
emit the snippet; `tiger_aff=jane` sets dimension 1 before the pageview; invalid cookie
ignored; admin route gates to login; admin view renders.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ
Adds the matomo module to the generated capability index (CI `check` gate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TIGER-306 — the TigerAnalytics adapter
A new first-party
matomomodule — the config-selected tracking driver the ticket calls for, built as a sibling ofanalytics(GA4): sameTiger_Trackingregistry shape, same consent gate, both can be active at once.What it does
Matomo_Plugin_Tagemits the self-hosted Matomo_paqsnippet into thetigerTrackinghead placeholder, consent-gated (Tiger_Consent::allows('analytics')), staff-excludable, fail-open. Works standalone with zero affiliates./a/<name>contract cookie (tiger_aff), validates the name, and pushes a Matomo visit-scoped custom dimension beforetrackPageView— so visits + conversions segment by affiliate (the custom dim this populates is the one the TIGER-304 install created)./matomo/admin, admin-only) +/apisave to the config tier (url, site id, affiliate dimension index, enabled, exclude-signed-in). 7 locales.The module boundary (vs TIGER-303)
This module reads the affiliate cookie; TigerAffiliates (TIGER-303) writes it and owns the
/a/<name>route. The cookie name/format is fixed here as the contract (Matomo_Plugin_Tag::AFFILIATE_COOKIE+AFFILIATE_NAME_RE) so 303 writes exactly what this reads. No route/cookie-write here = no dual-owner collision later.Proof
analytics-dev.webtigers.com): guest pages emit the snippet (setSiteId '1', loader);tiger_aff=jane→setCustomDimension', 1, "jane"before the pageview; invalid cookie ignored;/matomo/admingates to login; the admin.phtmlrenders (all i18n keys resolve, no fatals).analyticsalready owns) throws fatally during the module scan — now auto-assigned.🤖 Generated with Claude Code
https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ