- First import the library:
import{NAME_OF_SPLIT_TEST}from'/path/to/constants/split-test-experiments';importtgSplitTestfrom'teamgantt-split-test';- Check if the user is in the split-test:
constisUserInSplitTest=tgSplitTest.isInExperiment(NAME_OF_SPLIT_TEST);Note: If the user is not in the current split test, it will place them in the test and return their placement.
- The experiment should be handled in such a way that it follows the following logic:
if(isUserInSplitTest){// the experiment, the current user should see the changes from the split test}else{// the original, the current user should not see any changes}- Import the split-test bundle:
<scriptlanguage="javascript" src="https://split-test.teamgantt.com/index.js"></script>- Check if the user is in the split-test:
varisUserInSplitTest=window.tgSplitTest.isInExperiment(NAME_OF_SPLIT_TEST);- See step #3 above.