Variables are placeholders that pull information from user activity into your analytics or ad platforms. For example, a variable called Price could be populated with the price of whatever product a user is viewing. To configure a variable:
- Open the container you created.
- In the Variables tab, hit Add Variable.
- In the sidebar, give your variable a name
- Choose your variable type. You have the following options:
- Data Layer: A standardised way to present data to software tools. Often used for eCommerce data.
- URL Parameter: Anything after the “?” in a URL, usually in a standard utm_ format. Usually used for campaign tracking.
- Cookie: Pull data from browser cookies.
- DOM Element: Any page element that can be isolated using classes.
- JavaScript variable: Any JS variable you want to configure.
- Constant: A static value you have defined.
- Referrer: Where the user came from before hitting your website.
- Page URL: The full URL (including parameters) of the current page.
- Page Path: The current URL minus the domain.
- Page Hostname: The base URL of the current site (useful if you track multiple domains).
- Hit Create Variable.