Connecting our AB testing system to Plasmic AB test variants

Good morning everyone. We are working on connecting our AB test system to Plasmic AB test variants (with codegen). We have it working in a way that requires us to manually add the variant providers for new experiments. I see PlasmicRootProvider takes a globalVariants prop that also handles variant selection… or there is a variation prop that can take external IDs for experiment selection… I may be confusing these props? The shape of their values is different I believe:

{name: /* experiment name */, value: /* selected variant */}

{ext.${/* external experiment id */}: /* external id for selected variant */}

Both approaches are not selecting variants as we hope. Our backup plan is a script that inserts variant providers with values/selections at build time… but hoping there is an easier way.

Any hints appreciated!

Hi! I think you’re looking at the Plasmic Root Provider for our headless / loader use case. Since you’re doing codegen, you wouldn’t be using the loader package; you’ll be using the react-web package instead, which doesn’t have those props. Instead you’ll have to roll your own for now. You could build an ExperimentsProvider that takes in the variations to activate and just wraps your root in the proper providers too.

yes, was hoping Plasmic Root Provider would do the variant context loading magic. I like the idea of writing our own provider that does this… was struggling with how to know the experiment/context names… but I see them listed in plasmic.json! So I think we have a good path here. thanks!