> For the complete documentation index, see [llms.txt](https://docs.jentis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jentis.com/jentis-dcp-elements/variables/server-side-variables-backend/use-cases-for-server-side-variables.md).

# Use Cases for Server Side Variables

Server-side variables can access all the details of the server-side environment, including the local storage on the virtual machine or any value that is submitted from the client-side to your JENTIS server.

### Read and Write Local Storage Properties

With the following server-side variable, you can access an event's property, check the value, and return a result based on it. For this, local storage is very helpful, which can hold information for later use. One example might be a situation where you want to deduplicate transactions that are tracked in your frontend. Sounds interesting? Here is a detailed guide on implementing a server-side deduplication function with server-side variables.

The basic syntax of server-side variables follows this general template:

{% code lineNumbers="true" %}

```javascript
async function(){
  var storage_value = await this.storage.read("storage_name");
  
  this.storage.write("storage_name", "updated value", Date.now()+94608000000);
}
```

{% endcode %}

### Server-Side to Client-Side variable references

This feature enables users to access the value of another client-side variable within a client-side variable. As a result, it is possible to reuse values from existing variables. Furthermore, even references of references of references are achievable.

The reference functionality can be used like this:

{% code lineNumbers="true" %}

```javascript
this.getFrontendVariable("<ID of client-side variable>");
```

{% endcode %}

The ID of a variable can be found in the edit view of the JTM in the property field “ID”.\\

<figure><img src="/files/42NxQb6b60GoY7F2CtQW" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
It is important to note that this functionality only works with the JENTIS wrapper scripts we provide.
{% endhint %}

Full client-side variable example for gathering the screen resolution:

{% code lineNumbers="true" %}

```javascript
async function() {
    return this.getFrontendVariable("window_screen_width") + " x " + this.getFrontendVariable("window_screen_height");
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.jentis.com/jentis-dcp-elements/variables/server-side-variables-backend/use-cases-for-server-side-variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
