Data layers
Data layers are JavaScript objects that pass information from a property to a tag manager container. DXA allows you to create data layer rules to read data from an existing data layer and use the values to create page groups, trigger tracked events, and add custom dimension data.
Adding a data layer rule
On the navigation bar, go to settings > Property Settings > Data Layer and click + Add Data Layer.
Enter a Variable name to be used in the Action entered below, not including the data layer value. For example,
dataLayer.pageType
.Enter a Description about the data layer.
Select an Action. The following options are available:
Create page group — Creates a new page group based on the variable name. Using
dataLayer.pageType
returns values such asPDP
,Checkout
, andHome
. Page groups will be created and named after the returned values. If a page group has already been created, the page will be added to this group. You can select a limit to the number of page groups that will be created.Add to custom dimension — Adds the variable value to one of the existing Custom dimensions. A Custom dimension dropdown menu appears allowing you to select the custom dimension you want to add the variable value to.
Create Tracked Event — Allows the creation of Tracked Events based on variable values. The tracked event name will be taken from the value passed from the variable and will trigger upon changes in the value.
Click Save Data Layer.
The data layer rule is saved and appears on the table in Data Layer Settings. Edit or delete the data layer using the buttons in the Actions column on the table.