# getFrontendVariable

### `getFrontendVariable` Function

The `getFrontendVariable` function is used to **retrieve the value of a client-side variable** or to **evaluate it on demand** during the execution of another variable.

#### Purpose

This function allows you to reference or reuse the value of another **client-side variable** by its **variable ID**, making your setup more modular and maintainable.

***

#### Function Signature

```ts
this.getFrontendVariable(variableId: string): any
```

#### Parameters

* **`variableId`** (`string`, required):\
  The ID of the client-side variable you want to retrieve.\
  This ID must match the **internal name** defined in the JENTIS Tag Manager.

***

#### Return Value

* **Type:** `any`\
  Returns the value of the specified client-side variable.\
  The returned type depends on the definition of the referenced variable.

***

#### Example

**Retrieve the value of another client-side variable**

```js
function() {
  let referrer = this.getFrontendVariable("document_ref_diff");
  return referrer;
}
```

In this example, the value of the `document_ref_diff` variable is retrieved and returned from within another client-side variable.

***

#### Use Cases

* Compose variables by combining values from other client-side variables.
* Avoid duplicating logic across multiple variables.
* Maintain a centralized and DRY (Don't Repeat Yourself) configuration.

This function is essential when building dynamic tracking setups that depend on multiple contextual inputs from the browser.
