Is there a way to check if a user is in an experiment using JavaScrip SDK?
I have a landing page experiment running in a layer, it's targeting gate is page_url
contains.
When a user lands on a page without meeting targeting gate conditions, I still get an experiment_id.
In diagnostics it is written: Failed targeting.
Why in this case I still get a value of an experiment by using:
layer = statsig.getLayer("layer_name");
layer.allocatedExperimentName // I was expecting this to be set
layer.allocatedExperimentName
should have the name of the experiment the user is allocated to.
That said there are times when the layer is empty, meaning there are no experiments allocated to that portion of the layer, in which case, getLayer
will return default values and the allocatedExperimentName
will be undefined.