Targeting by User

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 users.

HappyKit allows you to do pass in a user. You can use that user and the provided uesr profile for rules or percentage-based rollouts. The fields supported in the user profile are defined in the README and in the TypeScript types.

Render #1 (Current render)
{ flags: { ads: true, checkout: "short", discount: 5, purchaseButtonLabel: "Purchase" }, data: { flags: { ads: true, checkout: "short", discount: 5, purchaseButtonLabel: "Purchase" }, resolvedVariantIds: { ads: "on", checkout: "on", discount: "on", purchaseButtonLabel: "on" }, visitor: { key: "M5yVXOs5oQB2yk3cu_0ir" } }, error: null, fetching: false, settled: true, visitorKey: "M5yVXOs5oQB2yk3cu_0ir" }

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