> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trevosdk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parameters

> Values your app reads by name, so a later experiment can change them without a release.

An experiment usually ships its variants as code: the app branches on `getVariant()`. On
mobile that means every new test waits for store review and for users to update.

A parameter is a named value your app reads instead, with a default it falls back to:

```ts theme={null}
const headline = trevo.getParameter('paywall.headline', 'Subscribe');
const trialDays = trevo.getParameter('paywall.trial_days', 7);
```

The code ships once. After that, any experiment can set different values for each variant,
and the app picks them up from config with no new build.

## Setting values

Open an experiment that hasn't started, choose **Edit**, and add rows under
**Parameters**: a name, a type (text, number or true/false) and a value for each variant.
Leave a variant blank to keep what users get today: the last shipped value for that
parameter, or the app's default if none has shipped. That's how control usually reads, so
a new test measures against the real baseline.
Values lock when the experiment starts, like the traffic split, so one arm never mixes two
treatments.

A values-only experiment needs no pull request: create a custom experiment, set its values,
and start it.

## Lists and translated text

A text value can carry more than one string:

* **JSON**, up to 4,000 characters, for a list of plans, feature bullets or an ordering. Every
  value of a parameter must have the shape of the one your app parses today, or Trevo refuses it.
  Read it as text with today's JSON written out as the default, so Trevo can read that shape from
  your code, and parse it with a fallback:

  ```ts theme={null}
  let plans = DEFAULT_PLANS;
  try {
    plans = JSON.parse(
      trevo.getParameter('paywall.plans', '[{"id":"pro_monthly"},{"id":"pro_yearly"}]'),
    );
  } catch {
    // Keep the app's own list.
  }
  ```

* **Text per language**, for an app that translates its text. Pick **Text per language** as the
  type and write `{"en": "Start free", "de": "Kostenlos starten"}`, using only languages your app
  ships. Pass your app's own translation as the default, and tell the SDK which language the app
  shows:

  ```ts theme={null}
  trevo.setLocale(i18n.language);
  const headline = trevo.getParameter('paywall.headline', t('paywall.headline'));
  ```

  The SDK shows the text for that language, falling back from a region to its language (`pt-BR`
  to `pt`), and your translation for any language the value lacks. Without `setLocale` it uses the
  page's `<html lang>` or the device's language. In React, call `useTrevo()?.setLocale(tag)`; on a
  server, pass `{ locale }` to `getParameter`. Builds from before text per language show your
  translation to everyone, so Trevo's pull request notes an SDK that is too old.

## Ideas from Trevo

Trevo's repo scan finds the parameters your app reads. When an idea only changes their values,
the proposal says so: approving it opens no pull request, and you start it straight away. Trevo
won't propose a value another experiment already sets.

On a mobile app, an idea that changes one piece of text, one number or one on/off switch can
set up a new parameter, and on an app that translates its text, the idea writes the new text in
every language it ships. Its pull request makes the app read it, with today's value as the default,
and every later idea on it is values-only. When the experiment ends, the read stays in your code.

## What the app gets

* **The running experiment's value.** `getParameter` assigns the user exactly as
  `getVariant` would, records the exposure, and returns that variant's value.
* **The default** when no experiment sets the parameter, before config has loaded, or when
  a value's type differs from the default's. A bad value never reaches code typed for
  something else.
* **One experiment's value at a time.** A running test takes over a parameter from a
  shipped winner; between two shipped winners, the newer one wins.
* **The winner's value after you ship.** A shipped experiment keeps serving its winning
  value until a newer experiment takes the parameter, because the default in your code is
  still the old value. Updating that default is optional: it matters only if you stop
  serving config.

One running or paused experiment can set a given parameter at a time. Starting a second
one on the same parameter is refused until the first ends.

## Supported SDKs

`getParameter` is in the browser, React Native, iOS, Android, Flutter and Node SDKs, and
`useParameter` in `@trevosdk/react`. Python and Ruby don't have it yet.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.