Setting up experiment monitoring with Potions Experiment Tag

Potions Experiment Tag enables you to get a visitor’s audience for a given experiment (AB test) in Javascript and monitor experiment KPIs by audience


To monitor experiment in Potions :
  • add this javascript snippet to your pages if you use GA4 with GTM (contact us for other tools)
    • javascript
      <script async="" type="text/javascript" src="" crossorigin="anonymous" ></script>
  • call this endpoint in javascript to get your visitor’s audience for a given experiment and adapt the visitor experience to the audience retrieved
    • javascript
      window.recos.getAudienceGroup(EXPERIMENT_ID) // response : Promise<A or B>
      where EXPERIMENT_ID is a unique uuid given in Potions Platform.

How it works

This API has 2 scenarios :
  • if it’s the first time the API is called in the navigator, getAudienceGroup:
    • calls Potions Server to get the audience (A or B) with the repartition set in the platform
    • saves this audience in IndexedDB
    • sends a Potions Analytics Event set_experiment_audience
  • if it’s the second time or more the API is called on the navigator, getExperimentAudience :
    • returns the audience saved in IndexedDB