Skip to content

I2I: Pass experiment config down into 3p iframes as window.context #6684

@lannka

Description

@lannka

This will give code running inside 3p iframes access to the our experiment flags.

Looked at how we currently compute the experiment config, I noticed a bunch of changes need to happen:

  • Currently, a single experiment status is lazily computed. Since we will want to share the same experiment config with all 3p frames, we we'll need to compute them all in once.
  • Note that an experiment status is a combination of "AMP_CONFIG + cookie_flag + toggleExperiment()". If we precompute all the experiment status in once, that means any dynamic change to AMP_CONFIG will not be picked up. Same to toggleExperiment(). It actually makes sense to disallow changes of AMP_CONFIG in runtime, we will just need to fix some existing code that are writing AMP_CONFIG dynamically. toggleExperiment() is tricky though. Developer will have to run toggleExperiment() in the 3p iframe window.
  • To precompute all the experiment status, we will want to enumerate all keys in AMP_CONFIG. However, not all keys in AMP_CONFIG are experiments. It contains things like AMP_CONFIG>v and AMP_CONFIG.canary. Once temporary hack is to only pick keys that have a numeric value in range of [0,1]. In long term, we might consider put all experiment config in AMP_CONFIG.experiment.

@dvoytenko @erwinmombay

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions