Map data layer objects to data elements

Once your organization has established and implemented a data layer on your site, you can map data layer objects to data elements within tags.

Prerequisites

Create a data layer: Make sure a data layer exists on your site. While you technically can map any JavaScript object or scrape CSS elements directly from the page, Adobe recommends this practice as a last resort. If your site layout changes, the CSS selectors used in tags stop working, causing data loss.

Use tags to create data elements

Data elements are components in Adobe Experience Platform Data Collection that you can use across the tool. You can assign variable values in the Adobe Analytics extension using data elements.

The following steps use the Adobe Client Data Layer extension, which must be installed in your tag property.

  1. Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.

  2. Select the desired tag property.

  3. Select the Data Elements tab, then select Add Data Element.

    create data element

  4. Enter a name for your data element, such as Page name.

  5. Under the Extension drop-down list, select Adobe Client Data Layer.

  6. Under the Data Element Type drop-down list, select Data layer computed state.

  7. Under Return value, select Specific path, then enter the path to the value in your data layer, such as page.name. To validate a path, run adobeDataLayer.getState("page.name") in your browser’s console.

  8. Select Save.

Use these data elements in rules that the extension’s Data layer push event triggers, so that the data layer has loaded and contains the data from the push. See Data element types.

Object-based data layers object-based

If your data layer is a JavaScript object, such as a CEDDL digitalData object, use the JavaScript Variable data element type from the Core extension instead. Enter the path to the value, such as digitalData.page.pageInfo.pageName. This data element type can’t read the Adobe Client Data Layer, which stores its data in a computed state instead of in object properties.

Next steps

Map data elements to Analytics variables: Assign data elements to Analytics variables so you can use them as dimensions in Analysis Workspace.

recommendation-more-help
analytics-help-implement