Internal variables
These variables are called internal variables because they are created inside the TagCommanders container: They are integrated directly into your site’s container, in contrast with external variables, which are added into the page’s source code by the technical staff.
Internal variables are used to collect data to enrich data through the external variables. A library of predefined internal variables is available, but you can also create your own.
Internal variables must be created in the TagCommander interface before they can be used in containers. See the rest of the articles in the “internal variables” section to know more about the different options available to create such variables.
All internal variables created can be used:
- To be added to the solutions embedded in the container (linking internal variables and solutions is called mapping). See the “Mapping tags’ variables” article to find out how to map your internal variables in a tag.
- To create activation rules for your tags. See the “Adding Rules” article to find out how to create rules based on your internal variables.
Additional information
Internal variables are all coded in JavaScript, but you do not need any technical knowledge of JavaScript in order to use the “Predefined” variables or the “Builder” modes, since the code is generated automatically by the TagCommander. However, you will need to know JavaScript or seek help from the Commanders Act support team in order to create your own custom internal variables.
Here are some examples of predefined internal variables:
- Internal variable for retrieving the URL of the page:
- Internal variable for retrieving the URL of the previous page/site:
- Internal variable for retrieving what comes between the first “/” and second “/” of the URL:
There are several situations in which you may need to create an internal variable using the internal variable management interface:
- You want to retrieve elements available on your web pages, but they do not have external variables implemented by technical staff (for example: the value of a cookie, HTML tag, URL, etc.).
- You want to create a new variable based on the values of external variables already implemented by technical staff (for example: calculating the cart’s total before tax using the external variable that returns the cart’s total including tax).
- You want to create a lookup table based on an external variable (for example: when the external “country” variable is “FR”, you send an account number to your analytics tool that is different from when the variable is “IT”).
- Etc.
The link created between the internal variables and the solutions is called “mapping“. This is performed in the “EDIT” tab during the container deployment process.
There are two types of internal variables: predefined and custom.
- Predefined internal variables, have already been created and are ready to use (e.g. variables that retrieve URL fragments).
- You can also configure your own internal variables, using pre-existing variables (e.g. external variables) or retrieving elements available on your sites’ pages (e.g. cookies).
You will then be prompted to select a predefined variable universe.
The “add variable