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:
- $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.
The variable creation window contains different fields:
(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).
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)
To add a new predefined server-side internal variable, click “Server-Side” > “Internal variables” > “Add predefined variables” (1).
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):
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).
- 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):