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
Setup
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="https://client.get-potions.com/SITE_ID/recos-tag.js" 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
javascriptwindow.recos.audience(SITE_ID, 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, audience:
- 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, audience :
- returns the audience saved in IndexedDB