Targeting by Visitor Key

This demo is easiest to understand if you open its source code in a parallel tab.

Source code

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: "full", discount: 5, purchaseButtonLabel: "Get it" }, data: { flags: { ads: true, checkout: "full", discount: 5, purchaseButtonLabel: "Get it" }, resolvedVariantIds: { ads: "on", checkout: "1617854290624", discount: "on", purchaseButtonLabel: "1617982711642" }, visitor: { key: "gvfh5sce7FUiwxOUQCcg_" } }, error: null, fetching: false, settled: true, visitorKey: "gvfh5sce7FUiwxOUQCcg_" }

Note that aside from visitors, HappyKit also has the concepts of a user and traits. These three concepts are all independent of each other.