This demo shows how to use @happykit/flags
for targeting visitors.
HappyKit allows you to do percentage-based rollouts or A/B testing. To do this, HappyKit automatically creates a unique visitor key for every visitor and saves it as a cookie. You don't need to manage it yourself. The visitor key can not be passed in at all.
If you know more about the visitor, you can use configure your HappyKit Flags to use percentage-based rollouts or A/B testing based on the passed in user instead. HappyKit makes distinguishes users and visitors. You have control over the user HappyKit sees, but HappyKit controls the visitor.
Render #1 (Current render){ flags: { ads: true, checkout: "short", discount: 5, purchaseButtonLabel: "Purchase" }, data: { flags: { ads: true, checkout: "short", discount: 5, purchaseButtonLabel: "Purchase" }, visitor: { key: "OUEa8XpYiPI80-Vs3Ad3_" } }, error: null, fetching: false, settled: true, visitorKey: "OUEa8XpYiPI80-Vs3Ad3_" }
Note that aside from visitors, HappyKit also has the concepts of a user and traits. These three concepts are all independent of each other.