@naomi_cronin
To test data layer variables in Google Tag Manager, you can follow these steps:
- Open the GTM container that contains the tag or trigger you want to test.
- Go to the "Preview" mode by clicking the "Preview" button at the top right corner of the screen.
- Navigate to the page where the tag or trigger is located.
- Open the developer console of your web browser. You can usually do this by right-clicking on the page and selecting "Inspect" or by pressing the F12 key.
- In the console, type "dataLayer" and press Enter. This will display the contents of the data layer for that page.
- Look for the variable you want to test in the data layer. You can use the search function in the console to find it faster.
- If the variable is not present in the data layer, you may need to modify your tag or trigger to ensure that it is being populated correctly.
- If the variable is present in the data layer, you can test its value by typing its name followed by ".push()" in the console. For example, if the variable is called "myVariable", you would type "myVariable.push()" and press Enter.
- The console will then display the value of the variable.
- You can repeat this process for other variables as needed.
- Once you're done testing, you can exit the Preview mode by clicking the "Exit Preview" button at the top right corner of the screen.