You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change adds zero-config Matomo event tracking for common interactive UI elements on the frontend. Buttons and CTA-like components are tracked globally through the JavaScript _paq.push(['trackEvent', ...]) API, including dynamically injected DOM.
What changed
Added a small frontend tracking module to the main municipio entrypoint.
Uses a single delegated document click listener instead of per-component initialization.
Moves tag assignment and targeting to the backend where possible through the existing ComponentLibrary/Component/Attribute filter.
Targets:
Native <button> elements
Component-library rendered links/buttons that receive backend-injected data-matomo-* attributes
Tracking model
Emits Matomo events as:
Category: UI Interaction
Action: Click
Name: derived from data-matomo-name, then aria-label, title, then visible text
Keeps value omitted unless explicitly needed later.
Attribute normalization
Backend injects default data-matomo-category and data-matomo-action on eligible rendered components.
Frontend normalizes data-matomo-name on matching elements and preserves explicitly provided data-matomo-* overrides.
Design/system impact
Makes targeting more backend-driven for design system/component-library output.
Keeps delegated frontend tracking for native buttons and dynamically inserted DOM.
Uses closest(...) matching so nested label/content inside tracked elements resolves to the correct target.
CopilotAI
changed the title
[WIP] Add support for automatic Matomo event tracking
Add global Matomo _paq click tracking for buttons and CTA links
May 5, 2026
@copilot I want the tag assignment and targeting to be more backend driven. Utilize the components filters to insert these where we can instead.
Updated to move the targeting/tag assignment backend-side via ComponentLibrary/Component/Attribute, so component-rendered links/buttons now get the Matomo attributes server-side and the JS listener keys off those markers plus native buttons. Addressed in 65e5392 (follow-up c682509). Screenshot: https://github.com/user-attachments/assets/6ecd4ce2-d5fa-46b9-8d01-a95c264f3626
CopilotAI
changed the title
Add global Matomo _paq click tracking for buttons and CTA links
Add global Matomo _paq click tracking with backend-driven component targeting
May 5, 2026
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
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.
This change adds zero-config Matomo event tracking for common interactive UI elements on the frontend. Buttons and CTA-like components are tracked globally through the JavaScript
_paq.push(['trackEvent', ...])API, including dynamically injected DOM.What changed
municipioentrypoint.documentclick listener instead of per-component initialization.ComponentLibrary/Component/Attributefilter.<button>elementsdata-matomo-*attributesTracking model
Category:UI InteractionAction:ClickName: derived fromdata-matomo-name, thenaria-label,title, then visible textvalueomitted unless explicitly needed later.Attribute normalization
data-matomo-categoryanddata-matomo-actionon eligible rendered components.data-matomo-nameon matching elements and preserves explicitly provideddata-matomo-*overrides.Design/system impact
closest(...)matching so nested label/content inside tracked elements resolves to the correct target.Implementation sketch
Screenshot