of data layer picker The custom variable template is Google Tag Manager Community template gallery.
explanation
With data layer picker variables, you can: Access key and value in the dataLayer.push()
This called a tag where the variable was evaluated.
This is different from how data layer variables work, as DLV doesn’t care (or remember) what. push()
A key has been added to GTM. Instead, merge everything into the data model.
However, the data layer picker allows access to the exact contents of the pushed object. dataLayer
.
There are many use cases for this, such as when you need to access a specific location. state of dataLayer
Messages before they are merged with other keys in GTM’s data model.
There are two options for using variables.get either whole object pushed in dataLayer
or fetch the value of specific key. can be used dot notation When specifying a property name.
The template first tries to get the nested structure at the end of the dot notation path (e.g. gtm.elementId
Find the value at the end of {gtm: {elementId: 'somevalue'}}
). If nothing matches, it tries to get the value as if the path in dot notation is a full key name by itself (e.g. gtm.elementId
Find the value at the end of {'gtm.elementId': 'somevalue'}
). If not, undefined
returned.
Templates also work with pushed objects dataLayer
By other custom templates.
Release notes
date | change set |
---|---|
May 26, 2021 | Fixes an issue where undefined objects corrupt variables. |
February 26, 2021 | Initial release. |