---
title: Track dynamic variables - WebView
description: Track dynamic variables in your apps using the Web Tracking Tag
lastUpdated: 14 April 2026
source_url:
  html: https://docs.contentsquare.com/en/webview-tracking-tag/track-dynamic-variables/
  md: https://docs.contentsquare.com/en/webview-tracking-tag/track-dynamic-variables/index.md
---

> Documentation index: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

Dynamic variables are additional information on the session that can be used to segment sessions.

For example, they can include information on the A/B Test variations displayed to the current user.

## Defining dynamic variables

To define and send a dynamic variable, directly use the key and String/Long value **once a first screenview has been triggered**:

```javascript
window._uxa = window._uxa || [];
window._uxa.push(["trackDynamicVariable", { key: my_key, value: my_value }]);
// key is a string
// value is either a string or an integer
```

**Type of the value** — The value can be either a **whole number** or a **string**. For each case, available features won't be the same in the Contentsquare app:

* For **whole numbers**, you will be able to do some algebra. Example: *sessions with dynamic variable key = "numberOfFriends" and value >= 10*
* For **strings**, auto-completion and Regular Expression will be available. Example: *sessions with dynamic variable key = "accountType" and value = "Premium"*

## Limits

### On the server side

* It is possible to save up to 40 distinct dynamic variable keys per screenview. If more are received, only the first 40 keys will be kept.
* If you are using the same key twice on the same screenview, the last value associated with the key will be collected.

### On the SDK side

* Every dynamic variable is composed of a pair of key (max. 50 characters) and value (max. 255 characters string or number of type `Long` between 0 and 232 - 1). In case these maximum lengths are reached, the SDK will automatically trim the exceeding characters.
* If key or value are empty, the SDK will instead send the literal string "cs-empty".
