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

# Context variables

> Store a named value per respondent — set by hand, from the URL or from an answer — and reuse it in the interview.

A variable is a named value that follows the respondent through the interview. You use it to personalize question titles and descriptions, to carry a piece of data you already had before the interview started, and to keep a value collected early available in every block that comes later. Variables also show up in the **Variables** column of the Responses table.

<Info>
  Context variables require **Advanced statistics mode**, which you turn on from the settings in the side menu. See [Advanced statistics](/en/advanced/advanced-statistics).
</Info>

## Where you manage variables

There are two entry points, and they act on the same list.

* **Campaign settings → Variables tab** — the tab next to Survey, Webhook and Quota in the settings modal.
* **Variable manager** — the button in the canvas bar, when you're working on the flow and don't want to leave it.

## Name and origin

Every variable has two things: a **name**, which is how you refer to it everywhere else, and an **origin**, which is where its value comes from. There are exactly three origins.

<ParamField path="Manual" type="origin">
  You set the value yourself when you define the variable. Use it for something that's the same for everyone in this study — a wave number, a market code, a starting score.
</ParamField>

<ParamField path="URL parameter" type="origin">
  The value comes from a parameter in the interview link. Use it when whoever sends the link already knows something about the person: source, list, customer ID.
</ParamField>

<ParamField path="Question answer" type="origin">
  The value comes from the answer to a question you pick. Use it to keep an answer available for the rest of the interview without asking again.
</ParamField>

## Syntax

You reference a variable with double curly braces:

```text theme={"dark"}
{{variable_name}}
```

When the respondent opens the question, the system replaces the placeholder with the current value of the variable.

## Variables from the URL

Add the parameters to the interview link.

```text title="Interview link" theme={"dark"}
https://survey.exoid.ai/example?university=MIT&course=Computer%20Science
```

You can then use them in question titles or descriptions.

```text title="Question content" theme={"dark"}
Title:        Welcome, students of {{university}}
Description:  You are enrolled in the {{course}} course
```

```text title="Output seen by the respondent" theme={"dark"}
Welcome, students of MIT
You are enrolled in the Computer Science course
```

<Note>
  Parameters in the URL are automatically decoded before display: `Computer%20Science` becomes `Computer Science`.
</Note>

## Variables from an answer

A variable whose origin is a question answer takes the value the respondent gave, and keeps it for all the following questions.

```text title="Question: What year of study are you in?" theme={"dark"}
Year 1  ->  study_year = "1"
Year 2  ->  study_year = "2"
Year 3  ->  study_year = "3"
```

A later question can use it in its title:

```text title="Title of the following question" theme={"dark"}
Year {{study_year}} students
```

```text title="Output if the respondent chose Year 2" theme={"dark"}
Year 2 students
```

## Overwriting variables

If a variable arrives from the URL and is then set again during the interview, the last assigned value wins.

```text title="Overwriting example" theme={"dark"}
1. Opening URL:              ?university=Harvard
2. Question "Confirm your university": the respondent selects MIT
3. Final value:              university = MIT
```

From that point on, all titles and descriptions use the new value.

<Warning>
  Reusing the same variable name in different places of the interview is allowed, but it overwrites the previous value without warning you. If you need both pieces of data, use two distinct names.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Logic and conditions" icon="git-branch" href="/en/logic/conditions">
    Show or skip a question, and decide where the respondent goes next.
  </Card>

  <Card title="Scripts" icon="code" href="/en/advanced/scripts">
    Write a variable from JavaScript with `vars.<name>`, based on the answers already given.
  </Card>
</CardGroup>


## Related topics

- [Key concepts](/en/concepts.md)
- [Troubleshooting](/en/troubleshooting.md)
- [March 5, 2026](/en/whats-new/2026-03-05.md)
