to collect data about what the visitors experience on the web page;
to communicate this data to digital analytics and reporting servers.
This document focuses on the data layer object API, and not on the data format used to persist the data within the data layer. The data layer imposes no specific data format, but Adobe recommends to use XDM to ease interoperability.
1. Register data that is to be merged into the data layer state.
2. Trigger events that relate to the data stored in the data layer.
3. Get the current data layer state of all merged data.
4. Register listeners that are called for specific events or data changes.
5. List the history of registered data and triggered events.
1. The page and other scripts can start to register data, to trigger events, and to register callbacks by adding them to the array, even before the data layer script itself has been loaded. This allows to load the data layer script asynchronously or deferred, ensuring that it won't affect the page load speed significantly.
2. The data layer array serves as a first-in-first-out queue that avoids racing conditions between scripts and offers at all times the full history of what happened. This allows to easily replay and debug what happened.