---
title: Sending dynamic vars - Web
description: Send dynamic vars from your web page
lastUpdated: 22 January 2026
source_url:
  html: https://docs.contentsquare.com/en/web/sending-dynamic-vars/
  md: https://docs.contentsquare.com/en/web/sending-dynamic-vars/index.md
---

## General principles

### Use

Dynamic vars are additional information on the session that can be used to segment users.

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

Unlike custom vars, dynamic vars can be sent at any time during a session and do not require to send a pageview.

### Limits

#### On the server side

It is possible to save up to 40 distinct dynamic variables per pageview. If more are received, only the first 40 distinct keys will be kept.

If multiple dynamic variables using the same key are fired per pageview, only the last value associated with the key will be kept

#### On the Tracking Tag side

Every dynamic variable is composed of a pair of key (max. 512 characters) and value (max. 255 characters string or integer from 0-4294967296). The key and value are truncated by the Tracking Tag before they are sent.

## Defining dynamic vars

[Tag Configurator Template: Dynamic Variable ](https://support.contentsquare.com/hc/en-us/articles/37271814927633-CSTC-Template-Dynamic-Variable)Use the Tag Configurator to implement dynamic variables through a visual interface.

To define and send a dynamic var at once, use the `trackDynamicVariable` command:

```html
<script type="text/javascript">
  window._uxa = window._uxa || [];
  window._uxa.push(["trackDynamicVariable", { key: my_key, value: my_value }]);
</script>
```

Allowed values are `number` or `string` — there are specific capabilities for each in the Contentsquare app:

* For values of type **number**, you can use operators (more than, less than, etc.).
* For values of type **string**, auto-completion and regular expressions are available.

## Verifying the sending of dynamic vars

Our [Contentsquare Tracking Setup Assistant Chrome Extension ↗](https://chrome.google.com/webstore/detail/contentsquare-tracking-se/pfldcnnaiaiaogmpfdjjpdkpnigplfca) displays each dynamic var sent.

### Inspecting the payload

If you can't use our Chrome extension, use the [`_cs_debug`](https://docs.contentsquare.com/en/web/cookies/#_cs_debug) cookie.

1. From the browser console, run this command to create the cookie:

   ```plaintext
   document.cookie = "_cs_debug=compressionDisabled"
   ```

   Note

   Sessions collected with the `compressionDisabled` flag on are filtered out from the Session Replay pipeline.

2. Reload the page.

3. In the Network tab, search for `dvar`, select the request, and check the value of the `dv` parameter.

### Checking the requests

To check the actual request that is sent for each dynamic vars package (several dynamic vars pushed at the same time bundled together in a single network request), follow GET requests sent to `//c.contentsquare.net/dvar`, with these parameters.

| Name | Description | Type |
| - | - | - |
| `dv` | Dynamic vars (compressed) | String |
| `pid` | Project ID | Integer |
| `r` | A random digit to avoid request caching | Integer |
| `uu` | Unique user ID | String |
| `pn` | Page number (each pageview increments of 1) | Integer |
| `sn` | Session number | Integer |
