-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Tracker Matomo Refactor #6423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bunsenstraat
wants to merge
127
commits into
master
Choose a base branch
from
trackerfix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tracker Matomo Refactor #6423
+8,722
−1,243
Conversation
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
Replace arbitrary pause() calls with DOM state markers (data-id attributes) for more reliable E2E test assertions. This follows the existing pattern used by 'compilerloaded' marker. Changes: - Add setE2EStateMarker() helper to MatomoManager - Add markers: matomo-bot-detection-complete, matomo-initialized, matomo-debug-plugin-loaded - Replace pause(2000-4000ms) with waitForElementPresent() in tests - Remove extra stabilization pauses after compilerloaded Benefits: - Tests wait for actual state, not arbitrary times - Faster test execution (no unnecessary delays) - More reliable in different environments (CI vs local) - Self-documenting test intent Test results: - Bot detection: 35/35 assertions passing (17.5s) - Consent group 1: 67/67 assertions passing (20.4s)
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.
Refactor: Comprehensive Matomo Tracking System Overhaul
Overview
This PR introduces a new
MatomoManager
class that completely refactors Remix's analytics tracking system, providing better privacy controls, type safety, and developer experience.🔧 Key Improvements
Privacy & Mode Management:
disableBrowserFeatureDetection
in anonymous modeCustom Matomo Dimensions:
click
- Boolean flag indicating user-initiated click eventsCustom Matomo Bot Domain:
Code Architecture:
@remix-api
window._paq
usage across entire codebase_paq
accessDeveloper Experience:
Cleanup:
loader.js
_paq.push()
confusion📋 Usage Examples
Type-Safe Event System
React Components (Context-based):
Plugin Classes (Direct calls):
🧪 Testing
matomo-bot-detection-complete
,matomo-initialized
,matomo-debug-plugin-loaded
) eliminate flakypause()
calls📦 Core Files Added/Modified
New Matomo Core Files:
apps/remix-ide/src/app/matomo/MatomoManager.ts
- Main tracking manager with queue, consent, and mode switchingapps/remix-ide/src/app/matomo/MatomoConfig.ts
- Configuration and constantsapps/remix-ide/src/app/matomo/MatomoAutoInit.ts
- Automatic initialization logicapps/remix-ide/src/app/matomo/BotDetector.ts
- Comprehensive bot detection with mouse behavior analysisapps/remix-ide/src/app/matomo/MatomoDebugPlugin.ts
- E2E testing helper for event inspectionapps/remix-ide/src/app/contexts/TrackingContext.tsx
- React context provider for componentslibs/remix-ide/src/lib/tracking/TrackingFunction.ts
- Factory for creating tracking functionsType Definitions & Events:
libs/remix-api/src/lib/plugins/matomo/core/base-types.ts
- Core Matomo event typeslibs/remix-api/src/lib/plugins/matomo/events/*.ts
- Type-safe event builders by categoryPlugin Integration:
apps/remix-ide/src/app/plugins/matomo.ts
- Matomo plugin exposing tracking APIE2E Tests:
apps/remix-ide-e2e/src/tests/matomo-consent*.test.ts
- Comprehensive consent flow testsapps/remix-ide-e2e/src/tests/matomo-bot-detection.test.ts
- Bot detection validation testsDocumentation:
docs/matomo-bot-detection.md
- Detailed bot detection mechanism documentation