> For the complete documentation index, see [llms.txt](https://community.commandersact.com/tagcommander/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community.commandersact.com/tagcommander/user-manual/serverside/datalayer.md).

# Datalayer

## External variables

Server-side external variables consist of all the information sent by your IT staff to Commanders Act through server-side hits (input hits).

Reminder of server-side incoming hits’ structure:

*<http://serverside$siteID$.commandersact.com/$containerID$/?variable1=value1\\&variable2=value2…>*

* *$siteID$ **and** $containerID$: Commanders Act site and container identifier*
* *variable1,* *variable2: server-side data layer’s variables (ex: ProductID, UserID, Order Amount…)*

You can use these external variables to populate server-side tags or to create firing rules to execute them.

Server-side external variables have to be declared in the “Options” tab from the “Commanders Act” interface at the beginning of the project (or later on if the data layer changes). To add a new variable, click the “ADD VARIABLE” (1) button in the “Server-Side” section from the “External Variables” menu.

![](/files/-LqfdtJGtwRK4gm6NzTS)

The **variable creation** window contains different fields:

![](/files/-Lqfdxb095XtyyaaWSl2)

(1) “**Name**”: variable’s name (mandatory field).

(2) “**Parameter label**”: parameter name within the incoming server-side hit (ex: order\_id in this hit  *<http://serverside123.tagcommander.com/1/?order\\_id=1234>).*

(3) “**Data storage**”: do not check this box in a classic server-side implementation. This option is used in hybrid server-side configurations. (Please refer to the corresponding article).

(4) “**Category**”: variable’s category. It allows you to classify variables according to their use (ex: variables pertaining to users, product pages, confirmation pages, etc.). Variables’ categories are added by clicking the “Manage categories” button next to the “ADD VARIABLE” button.

(5) “**Description**”: Variable description; it needs to be provided to simplify understanding of the variable’s name. (ex: “Page template” could be the description associated to the “env\_template” variable).

(6) “**Detailed** **description**”: Detailed description of the variable; it needs to be provided to simplify understanding of the variable’s name (ex: “possible values: homepage/category/product/funnel\_confirmation could be the detailed description associated to the “env\_template” variable).

When the variable is added, it appears in the variable’s list.

When a flag is displayed next to it, it means that it is currently being used in a tag or a rule. Click the flag to learn more (1).

![](/files/-Lqfe17Nm1Vq_OcZbi7i)

## Internal variables

There are two types of internal variables:

* Predefined internal variables, which are variables that are calculated automatically by Commanders Act servers
* Custom variables, which allow you to reformat server-side variables’ values with a correspondence table (equivalent to internal variables mapped within Web containers)

**1)-Predefined variables**

To add a new predefined server-side internal variable, click “Server-Side” > “Internal variables” > “Add predefined variables” (1).

![](/files/-LqfeVWxUsh7ltfDVPm-)

Select “server-side” (2) from the dropdown menu in the popin window and choose the variable(s), among those listed, you wish to add to your account. (Please note: the tick mark atop the column allows you to check/uncheck al variables) (3):

![](/files/-LqfefW2LOarh3dlcl55)

There are six default internal variables in your server-side container:

* **TC\_UNIQ\_ID**: Commanders Act user ID
* **IP**: Visitor IP
* **TC\_REFERER**: User referrer
* **RANDOM**: Random number between one and one billion
* **TC\_TIMESTAMP**: Time and date of the server-side hit
* **USERAGENT**: Server’s User Agent (IP, browser, etc. combination)

You can use these internal variables to populate server-side tags or to create firing rules to execute them.

**2)-Custom Variables – Correspondence Table**

To add a new mapped internal variable, click “Server-Side” > “Internal variables” > “Add variable” (1).

![](/files/-LqfelkZY5TeEZRas_KG)

* Enter your new variable’s name (2)
* Select the server-side variable you will use as reference to create your correspondence/matching table (3)
* In the “INPUT” column of the correspondence table, enter your reference server-side variable’s values (4)
* In the “OUTPUT” column, enter the values you wish to populate your new variable with (5)
* You can also add default values in case none of those present in the “INPUT” column are found (6)
* Click “SAVE” (7):

![](/files/-LqferBRCRRNDjEwZunN)


---

# 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://community.commandersact.com/tagcommander/user-manual/serverside/datalayer.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.
