# Client-Side Variables

## Introduction to Client-Side Variables

**Client-Side Variables** in JENTIS are used to extract data **directly from the user's browser** at the time an interaction or event is triggered. These variables allow you to access real-time client-side information and feed it into your tracking configuration within the JENTIS Tag Manager.

***

### What Are Client-Side Variables?

Client-side variables run in the user’s browser and are executed at a specific **predefined state** (e.g., pageview, click, form interaction). They are especially useful for capturing information that only exists in the browser at runtime.

***

### Common Use Cases

Client-side variables are ideal for collecting browser-specific or session-specific data, including:

* **User-Agent** string
* **Screen resolution**, width, and height
* **Current page URL** or **referrer**
* **Data attributes** from HTML elements (e.g., `data-product-id`)
* **Session or localStorage values**
* **Consent states** and interactions

***

### Key Features

* **Real-time browser data**\
  Retrieved at the exact moment a tag or trigger is executed.
* **No dependency on server logic**\
  Runs purely in the browser, ensuring minimal delay.
* **Execution Scopes**\
  Can be scoped to states like `Pageview`, `Click`, `Change`, etc.
* **Synchronous and Asynchronous options**\
  Simple variables run synchronously; HTTP-based logic can be handled asynchronously.

## How to Write a Client-Side Variable in JENTIS

To extract data from the browser, a **client-side variable** in JENTIS is based on a single **JavaScript function**. Here's a basic example that retrieves the full URL of the current webpage:

```javascript
function window_location_href() {
    return window.location.href;
}
```

In the next section, we’ll introduce the available **arguments provided by JENTIS**, which are accessible within a client-side variable, as well as the **public function scope** available for use.
