Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2project specificStack: javascript
analyticstrackingdata-attributes
Add the required tracking attributes to interactive elements
Interactive elements that feed analytics need their tracking attributes/labels (data-ga-action, gaLabel) set explicitly so events aren't attributed to a wrong default.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <a href={url}>{label}</a> // default ga category leaks |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <a href={url} data-ga-action='search' data-ga-label={label}>{label}</a> |
Explanation (EN)
Objašnjenje (HR)