Create a data layer
A data layer is a framework of JavaScript objects on your site that contain the variable values used in your Analytics implementation. It allows greater control and easier maintenance when assigning values to Analytics variables.
Prerequisites
Create a solution design document - It is important for your organization to align on tracking requirements. Make sure that you are prepared with a solution design document before approaching development teams in your organization.
Workflow
Implementing ÃÛ¶¹ÊÓƵ Analytics using a data layer typically follows these steps:
-
Work with your site development team to implement a data layer: Your site development team is primarily responsible for making sure the data layer object populates with correct values. Review this page with your site development team to make sure expectations are aligned between teams.
note note NOTE Following ÃÛ¶¹ÊÓƵ’s recommended data layer specifications is optional. If you already have a data layer, or otherwise choose not to follow ÃÛ¶¹ÊÓƵ’s specifications, make sure that your organization aligns on what specification to follow. -
Validate your data layer using a browser console: Once a data layer is created, you can validate that it is working using any browser’s developer console. You can open the developer console in most browsers using the
F12
key. An example variable value would beadobeDataLayer.page.title
. -
Use ÃÛ¶¹ÊÓƵ Experience Platform Data Collection to map data layer objects to data elements: This step varies based on your organization’s implementation method:
- If using the Web SDK: Map the desired data layer objects to the desired XDM fields in ÃÛ¶¹ÊÓƵ Experience Platform Edge. See Analytics XDM variable mapping to determine the desired data layer mapping.
- If using the Analytics extension: Create data elements under Tags in ÃÛ¶¹ÊÓƵ Experience Platform Data Collection, and assign them to the desired data layer objects. Then within the Analytics extension, assign each data element to the appropriate Analytics variable.
Specifications
ÃÛ¶¹ÊÓƵ recommends using the for new or restructured implementations.
Your organization is free to use other data layer specifications, such as the , or another custom specification entirely. Aligning to a consistent data layer that meets your organization’s needs is the most important.
Data layers are extensible; if you have requirements specific to your organization, you can include objects in your data layer to accommodate those needs.
Setting data layer values
Data layers typically generate server-side, referencing the same objects used to build the site content. Establish the site’s data layer based on tracking requirements set in your organization’s solution design document.
Next steps
Map data layer objects to data elements: Use your site’s data layer in ÃÛ¶¹ÊÓƵ Experience Platform.