A test environment is useful for making the container test step more “realistic” and more reliable.
The purpose is to simulate the production environment by assigning values to all the external variables as they would be on your site’s pages in the production environment.
Thus, real values from your data layer are added to the tags tested in the “TEST” step.
The test environment allows you to detect as many errors as possible in said step.
Go to the “TEST” step of the tag deployment process.
You will see tabs for all the test environments created and linked to the container (1):
The test environments will be tested along with the default environment (the default environment is a test environment available for all containers and all customers in which the external variables’ values are empty).
If the test environment returns an error, it will be displayed in the environment tab (NO). If an environment returns an error, the container will not be shown in the “DEPLOY” step.
To add a test environment, you must go to the “OPTIONS” tab > “Test Environments” and click “ADD TEST ENVIRONMENT” (1):
The “add” window consists of the following elements:
(1) “Name“: The test environment’s name (mandatory)
(2) “Environment JavaScript code“: The field to write the environment’s JavaScript code
(3) “Linked container(s)“: The containers you wish to link the test environment to
Once the test environment is added, it will appear in the list of test environments (1), click the pencil to edit them or the cross to delete them (2):
TagCommander allows you to include “free” JavaScript in the tag container, with no character limit, in two places named “Static JavaScript Code”.
The “Static JS codes” allow you to perform different types of actions, notably:
– Fixing data layer issues.
E.g. If your external variable “page_name” contains values with special characters, you can delete or replace them in the Static JavaScript code (e.g. change “&” into “and” as follows:
Thus, you can continue to use your external variable “page_name” in tags by removing its special characters via the Static JS code.
– Recovering data absent in the data layer from the site pages’ source code.
E.g. You can recover JQuery form fields in your Static JS block in the following manner:
The “Static JS codes” appear in two places in the left menu of the “EDIT” step interface:
– The first Static JS code is placed before the declaration of internal variables in the order that elements in your site’s container are executed (1).
– The second Static JS code is placed after the declaration of the internal variables (you can thus reuse previously declared internal variables in this position) (2):
The same user interface is used for the Static JavaScript code regardless of whether it executes before or after the internal variables. Just enter the JavaScript code you desire (1) and click “SAVE” (2):
agCommander allows dynamic JavaScript file(s) to be included in a tag container, in two places named “Dynamic JavaScript File(s)“.
Unlike “Static JavaScript codes“, “Dynamic JavaScript Files” are JavaScript files outside TagCommander that are downloaded and then added or updated in the container each time it is generated.
The “Dynamic JavaScript File(s)” allow you to perform different types of actions.
For example, you can use them to import a JavaScript file containing a JQuery library (if it is not already called on your site) or a JavaScript currency converter file into your container. By importing these files into TagCommander, you can add them to your solutions or use them to create new variables (for example, you can automatically update currencies in your solutions’ tags).
“Dynamic JavaScript File(s)” appear in two places in the left menu of the “EDIT” step:
The first Dynamic JavaScript File(s) is placed before the declaration of the internal variables, in the order that the elements of the container on your site are executed (1).
The second Dynamic JavaScript File(s) is placed after the declaration of the internal variables (you can thus reuse previously declared internal variables in this position) (2):
The same user interface is used for the Dynamic JavaScript File(s) regardless of whether they execute before or after the internal variables. Just enter the URL of your JavaScript file (1) and click “SAVE” (2):
You can perform this operation again for all the JavaScript files to be included in your tag container.
Caution: adding JavaScript files to the container will increase its size and thus increase the time for the pages to load.
You can update your dynamic file manually (by clicking “Refresh”), display its contents (“View”) or delete it (“Remove”) (1):