Skip to content

Support multiple activations page metrics#14072

Open
HarveyPeachey wants to merge 4 commits into
latestfrom
support-multiple-activations-page-metrics
Open

Support multiple activations page metrics#14072
HarveyPeachey wants to merge 4 commits into
latestfrom
support-multiple-activations-page-metrics

Conversation

@HarveyPeachey
Copy link
Copy Markdown
Contributor

@HarveyPeachey HarveyPeachey commented May 28, 2026

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

  • Uses every instead of some for checking activated experiments

Testing

  1. List the steps required to test this PR.

Useful Links

@HarveyPeachey HarveyPeachey marked this pull request as ready for review May 28, 2026 08:39
Copilot AI review requested due to automatic review settings May 28, 2026 08:40
@HarveyPeachey HarveyPeachey self-assigned this May 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 some to every when 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)),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants