# String Substitution

Many text fields and rules in GMetri support substitution out of the box.

## What is String substitution? <a href="#using-variables-through-text-substitution" id="using-variables-through-text-substitution"></a>

Let's say you have Text element, and you want to show the user his/her score, or a value that you captured earlier. How can  you do that?

By adding the following in the text element:

```
Hi {{firstname_var}}!

Your current score is {{score}}
```

and the values in the text element will get replace with the corresponding variables.

{% hint style="info" %}
To prevent escaping of special characters, you can use triple curly brackets `{{{variable_name}}} (Case Sensitive)`
{% endhint %}

## What are the values that I can substitute?

Apart from [#custom-variables](https://docs.gmetri.com/metaverse/build/variables/..#custom-variables "mention"), [#global-variables](https://docs.gmetri.com/metaverse/build/variables/..#global-variables "mention") and [#autogenerated-variables](https://docs.gmetri.com/metaverse/build/variables/..#autogenerated-variables "mention"), there are a few additional things available to you that you can substitute. These are:

* `viewer_token`: The token used to authenticate the viewer
* `session_uuid`: The unique identifier for this session. Unique for every page load.
* `organization_slug`: The identifier for the current workspace
* `deployment_slug`: The identifier for the current deployment
* `scene_id`: Contains the current scene id
* `deployment_url`: The URL that the viewer uses to access this experience

## Example <a href="#using-variables-through-text-substitution" id="using-variables-through-text-substitution"></a>

You can use variables in text elements through substitution​.

Let's say you have a Number variable with the name `count`. To view the value of `count` in a text element, you can add the text  `Count: {{count}}` in the text element. You will then see something similar to what you see in the experience below.&#x20;

To show the value of a variable in a Text element, add the name of the variable you want in **double curly brackets** like `{{variable_name}}`

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgll1jjQMRTVj7p6n7g%2Fuploads%2FjWvWQIyXho9K6bL6aEqb%2Fimage.png?alt=media&#x26;token=5ab58ea3-9574-4fc0-aa53-35f950f3f828" alt=""><figcaption><p>Variable Substitution</p></figcaption></figure>
