> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poool.fr/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to use custom variables with Poool Engage?

The `.variable()` function allows you to define custom variables that can then be reused inside your paywall text content.
This makes it easier to automatically update certain elements based on values passed from your technical configuration.

||| Implementing this feature requires support from your engineering team.

## Creating your own variables

To go further with variable usage, you can define your own custom variables and use them in the same way as native ones.
To do this, your technical team needs to create these variables in code (this is usually straightforward) 👉 [Technical documentation](https://www.poool.dev/en/docs/access/javascript/variables)
Once the variables are created, you only need to retrieve their names from your technical team and use them freely in your content.

## Use case: multi-language management

In a multi-language context, this feature can be used to automatically display text in the correct language depending on the user’s locale.
Language detection is handled on the technical side, so no configuration is required in the Dashboard.

## Example technical setup

Your engineering team prepares translations for each language:

```
const texts = {   
  fr: { article: "Article offert" },  
  en: { article: "Free article" },  
  es: { article: "Artículo gratuito" }  
};
```

Then, based on the detected locale, the custom variable is set dynamically:

```
engage.variables('article', texts[locale].article);
```

## Using variables in the Dashboard

Once the variable is defined in code, you can simply use it in your element:

```
{article}
```

The displayed text will automatically adapt to the user’s language:
* 🇫🇷 French user → Article offert
* 🇬🇧 English user → Free article
* 🇪🇸 Spanish user → Artículo gratuito

## Example
Below is an example of an element fully built using dynamic variables.

![](https://storage.crisp.chat/users/helpdesk/website/-/5/f/5/0/5f50f52b22503800/image_i1zqhd.png)

## Important note

In this setup, variables are fully defined on the technical side.
This means that in the Dashboard preview, variable values will not be replaced automatically.
You will still see placeholders such as `{article}`.
On the live site (or staging environment), the variable will be correctly replaced based on the user’s language.

## Useful links

* [📘 Poool Engage Documentation — Variables](https://www.poool.dev/en/docs/engage/javascript/variables)