What is Data Layer


A data layer is an object that contains all the information you want to pass from your website to a tag manager (for example, Google Tag Manager). The data layer is simply a JavaScript array that is used to store information and send this data to the tag manager.

The data layer is a data structure that has all the data you want to process and transmit from a website (or any other digital context) to other applications that have been linked to it. The reason a data layer is used is because it is sometimes necessary to decouple semantic information from other information stored in the digital context.

The data layer and Google Tag Manager

The data layer allows you to take advantage of everything GTM has to offer, storing all the information you want on a site to share with tags.

The data layer can contain static information (independent of the architecture of the web or the actions that happen in it) or dynamic (linked to actions or transactions) that can later be useful in the analyticalprocess.

Data layer examples:

Information about the page, such as category, or type of visitor, can be saved in the data layer:

dataLayer = [{
'category': 'login',
'user type': 'top'

You can also save the interactions that happen on that page, through the dataLayer.push command.

For example, suppose a user enters certain information into a form, such as the city where they reside, something you want to track with a label in the container. You can add this data to the data layer instantly using a simple command.

'cityResidence': 'Madrid',