Google Analytics - Using the Data Layer

This page has a Data Layer. Data layers can be used to pass information to various tools including Google Analytics.

This is a simple page to help illustrate how the source code of a page with a static data layer may look. To see what I mean hit right click anywhere on the page and select view source, you will be able to see the code that makes this page.
In the source code you will see the static variable in the data layer, these can be used as triggers to fire particular tags (such as remarketing) and/or pushed to Google Analytics (in this case they would be dimensions but they could equally be based on metrics such as price or basket value).

For the best view of how this works use Google Tag Manger Debug tool as this will show the "Variables" that Tag Manager is able to call (SGMPageCat and SGMvisitorType are custom variable that have been taken from the Data layer. There are also tools such as WASP that will show you similar information without access the data layer.


The button below has some javascript, when the button is clicked it will push an event into the datalayer, this can be used as a trigger.