How to access a dataLayer variable in Google Tag Manager

Google Tag Manager for WordPress offers several so called Data Layer variables so that you can easily manage several use cases with you tags.

A typical use case is to exclude certain logged in users from being tracked in Google/Universal Analytics or to set some custom Analytics variables so that you can segment your data to see what logged in users are doing on your site compared to anonymous visitors.

You can access those data in Google Tag Manager using Data Layer variables.

  1. To do so, open Google Tag Manager and select the container of your website
  2. Select Variables on the left pane
  3. Scroll down to see the red New button in the “User-Defined Variables” section
  4. Click on it
  5. Select Data Layer Variable from the list:
  6. Enter the name of the variable you would like to access. You can read about the variable names of this plugin on that page:
  7. You may set a default value here as well depending on whether you need such a value
  8. Click the Save button and enter a descriptive name for the variable which you will see on the GTM UI while editing tags and triggers