To a computer programmer, a variable is a symbol in code that can be used to represent a value that will change. A Google Tag Manager variable performs that same function. Variables are used in both triggers and tags:
- Variables in triggers are used to define filters that specify when a particular tag should fire.
Example: Fire a pageview trigger when the url variable is “example.com/index.html”.
- Variables in tags are used to capture dynamic values.
Example: Capture and apply the transaction value and products purchased to a conversion tracking tag.
Tag Manager provides a set of commonly-used built-in variables in each container. You can create additional custom variables to suit your specific requirements.