Comment on page

Provide targeting attributes

Hypertune is uniquely architected to let you define targeting attributes at the:
  • root level
  • individual flag level
And provide them during:
  • SDK initialization
  • local flag evaluation
  • a mix of both

Provide targeting attributes during SDK initialization

To provide targeting attributes during SDK initialization, use an initialization query.

Provide targeting attributes during local flag evaluation

Typically, you'll provide targeting attributes when locally evaluating the root flag, passing it the context argument you defined in your schema. You'll get back the Root SDK node which will have type-safe methods to evaluate all your individual flags. For example:
import React, { useEffect, useMemo } from "react";
import hypertune from "./hypertune";
export default function useHypertune() {
// Trigger a re-render when flags are updated
const [, setCommitHash] = React.useState<string | null>(
useEffect(() => {
return () => {
}, []);
// Return the Hypertune root node initialized with the current user
return useMemo(
() =>
context: {
user: { id: "test_id", name: "Test", email: "[email protected]" },

Provide flag-specific targeting attributes

You can also provide flag-specific targeting attributes when evaluating individual flags:
hypertune.upgradeCopy({ selectedPlan }).get(/* fallback */ "Upgrade your plan");