Skip to content
Indiana
Dashboard
Docs
Browse docs / Features, experiments and events

Features, experiments and events

Feature flags and experiments, event collection, URL redirect and visual experiments.

API v1Updated

Read Feature flags

flags.tsTypeScript
import { createIndiana } from "@tinkerlandai/indiana-sdk"; const indiana = createIndiana({  baseUrl: "https://api.tinker.cash",  scope: { projectId: "<APP_UUID>", environment: "sandbox" },}); export async function loadFlags(  customerToken: string,  customer: { id: string; externalUserId: string | null },) {  indiana.identify(customerToken);  const identity = { id: customer.id, externalUserId: customer.externalUserId };  const flags = await indiana.features({ attributes: { ...identity, country: "CA" } });  const enabled = flags.getFeatureValue("new-checkout", false);  const unsubscribe = flags.subscribe(() => console.log(flags.isOn("new-checkout")));  indiana.track("Checkout Viewed", { source: "pricing" });  await indiana.flush();  return { enabled, stop: () => (unsubscribe(), flags.destroy()) };}
  • Pass id (the Customer UUID) and externalUserId so a user gets the same experiment variation everywhere.
  • setAttributes() replaces all attributes; keep these two fields on every update.
  • Backends can read and evaluate with getFeatures or evaluateFeatures (features:read).

Track events

track(name, properties) records a behavior event and flush() sends it. Experiment exposures and Feature usage are recorded automatically; each kind can be turned on or off per environment in Console.

Website experiments

Load URL redirect and visual experiments on your pages without a credential. Copy the environment UUID from the experiment pages in Console.

experiments.tsTypeScript
import { createPageExperiments } from "@tinkerlandai/indiana-sdk/page";import { createVisualExperiments } from "@tinkerlandai/indiana-sdk/visual"; // The environment UUID is public; it selects published experiments and authenticates nothing.const redirects = createPageExperiments({ environmentId: "<ENVIRONMENT_UUID>" });const visual = createVisualExperiments({ environmentId: "<ENVIRONMENT_UUID>" }); export async function startExperiments() {  await Promise.all([redirects.start(), visual.start()]);}

Related operations

Features, evaluation and events (3)
getFeatures, evaluateFeatures, trackEvents

Related: Paths, credentials and scopes in All operations