From 553b88b3fcc1df940653c2c53ccee9b5f9611878 Mon Sep 17 00:00:00 2001 From: Dmytro Kireiev Date: Tue, 23 Mar 2021 14:47:24 +0200 Subject: [PATCH] update package --- README.md | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fa2c7f1..84d2439 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ # Use optimize-abtest in code 1. Install `npm i optimize-abtest` or `yarn add optimize-abtest` 2. Import `import useAbTest from 'optimize-abtest'` -3. Use `const { variant } = useAbTest('');` +3. Use `const { variant } = useAbTest('');` to compare with string `variant1` or `variant2` +4. Or simply use `const { isExperienceActive } = useAbTest('');` if there's only 1 variant available # Set up Google Optimize experiment 1. Create a new experiment @@ -17,4 +18,5 @@ document.cookie = "=variant1"; ``` ## A bit of explanation here -The package uses a session-long cookie named `` and one of its corresponding values either `variant1` or `variant2`. ```const { variant } = useAbTest('');``` returns one of the strings either `variant1` or `variant2` +The package uses a session-long cookie named `` and one of its corresponding values either `variant1` or `variant2`. ```const { variant } = useAbTest('');``` returns one of the strings either `variant1` or `variant2`. +Alternatively, you can import a boolean `isExperienceActive` witch return either `variant1` is active or not. diff --git a/package.json b/package.json index 4328ced..c741572 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,6 @@ "typescript": "^4.2.3" }, "files": [ - "**/*" + "index.js" ] }