Move frontend tracker check to EventEligibilityChecker
What does this MR do and why?
This is the follow-up @slashmanov asked for in his comment on the issue. I missed that comment, so !261296 (merged) merged without these two changes:
- Snowplow Micro no longer forces the page to load the tracker script. Micro does not change which events the backend forwards. It is also always on in development, so before this change GDK always loaded the script and the gated path could not be checked there.
- The check now sits next to the rules that decide which events get forwarded, with the same CE and EE split. CE loads the script when Snowplow or product usage data is enabled. EE also loads it when there are Duo events to forward. This way the page cannot drift from what the event forwarder sends.
For GitLab.com and EE instances nothing changes. FOSS instances in production only change if they set VERIFY_TRACKING, which used to turn on Micro and load the script.
I added CE and EE unit tests for the new check, pointed the existing page test at it, and removed the tests of the old check. The FOSS example only runs in as-if-FOSS jobs. Locally I ran ruby -c on the 7 changed Ruby files (all Syntax OK) and git grep to confirm nothing else calls the old check. The rest runs in the pipeline.
References
- Related to #604086 (closed)
- Follow-up to !261296 (merged)
Screenshots or screen recordings
Not applicable, there are no UI changes.
How to set up and validate locally
-
Run GDK as FOSS (
FOSS_ONLY=1). -
Disable Snowplow in the Admin area, and set
GITLAB_PRODUCT_USAGE_DATA_ENABLED=false. -
In the Rails console, check the new value:
Gitlab::Tracking::EventEligibilityChecker.send_frontend_events? # => false -
Reload any page. The page source no longer includes the tracker script.
-
Enable Snowplow again. The value is
trueand the script loads again.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Implemented with AI assistance; I reviewed and tested the changes.