Support multiple activations page metrics#14072
Open
HarveyPeachey wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens the gating in OptimizelyPageMetrics so page metric trackers only render once all experiments configured for the current page type have notified an activation decision, replacing the previous "any one activated" check. This forces the experimentsForPageMetrics list to be kept accurate and makes page view tracking emission timing more deterministic.
Changes:
- Switch from
sometoeverywhen checking activated experiments against the page type configuration. - Update existing tests to notify decisions for both configured experiments so they continue to render trackers.
- Add a new test asserting trackers are not rendered when only one of multiple configured experiments has been activated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/components/OptimizelyPageMetrics/index.tsx | Require every configured experiment for the page type to be activated before rendering trackers. |
| src/app/components/OptimizelyPageMetrics/index.test.tsx | Adjust existing tests to notify both experiments and add a negative test for partial activation. |
| optimizelyExperimentsEnabled && | ||
| Boolean( | ||
| experimentsForPageType?.some(name => activatedExperiments.has(name)), | ||
| experimentsForPageType?.every(name => activatedExperiments.has(name)), |
emilysaffron
approved these changes
May 28, 2026
pvaliani
approved these changes
May 28, 2026
elvinasv
approved these changes
May 28, 2026
shayneahchoon
approved these changes
May 29, 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
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.
Resolves N/A
Summary
Changes OptimizelyPageMetrics to check all experiments have been activated on the page, before rendering.
This will force devs to keep the list up to date, and make it more accurate for when page views will be sent.
Code changes
Testing
Useful Links