isHypothesisActive

The isHypothesisActive() method is the primary way to check whether or not a visitor is actively participating in a specific hypothesis that is assigned to a test.

The isHypothesisActive() method takes 1 required argument, and returns a Promise<boolean> representing whether the visitor is currently assigned to the hypothesis ID that was passed in.

Argument
Type
Description

hypothesisId

string

Id of the hypothesis from Shoplift

Example

window.shoplift.isHypothesisActive(hypothesisId).then(active => {
  if(active) {
    document.querySelectorAll(".chat").remove();
  }
});

Last updated