Create data elements

CAUTION
We expect to publish major changes to this tutorial on Friday March 15, 2024. After that point many exercises will change and you may need to restart the tutorial from the beginning in order to complete all of the lessons.

Learn how to create the essential data elements needed to capture data with Experience Platform Web SDK. Capture both content and identity data on the Luma demo site. Learn how to use the XDM schema you created earlier for collecting data using Platform Web SDK through a new data element type called XDM Object.

NOTE
For demonstration purposes, the exercises in this lesson build upon the example used during Configure a schema step; creating example XDM objects that capture content viewed and identities of users on the Luma demo site.
IMPORTANT
The data for this lesson comes from the digitalData data layer on the Luma site. To view the data layer, open your developer console and type in digitalData to see the full data layer available. digitalData data layer

Regardless of Platform Web SDK, you must continue to create data elements inside your tag property that map to data collection variables from your website, such as a data layer, HTML attribute, or others. Once you create those data elements, you must map them to the XDM schema you created during the configure schemas lesson. To do this, Platform Web SDK extension makes available a new data element type called XDM object. Therefore, creating data elements consists of two actions:

  1. Mapping website variables to data elements, and
  2. Mapping those data elements to an XDM object

For step 1, you continue to map your data layer to data elements the way you currently do, using any of the Core tag extension’s data element types. For step 2, Platform Web SDK extension creates a set of new data element types not previously available:

  • Event merge ID
  • Identity map
  • XDM object

This lesson focuses on XDM object and identity map data element types. You will create XDM objects to capture Luma visitors’ activity and authentication status.

Learning objectives

At the end of this lesson, you are able to:

  • Create data elements to capture content and user login ID data
  • Create an identity map data element
  • Map data elements to an XDM object data element

Prerequisites

You have an understanding of what a data layer is, gotten familiar with the Luma demo site data layer, and know how to reference data elements in tags. You must have completed the following previous steps in the tutorial

IMPORTANT
The Experience Cloud ID Service extension is not needed when implementing Adobe Experience Platform Web SDK, as the ID Service functionality is built into Platform Web SDK.

Create data elements to capture the data layer

Before you begin creating the XDM object, create the following set of data elements mapping to the Luma demo site data layer:

  1. Go to Data Elements and select Add Data Element (or Create New Data Element if there are no existing data elements in the tag property)

    Create Data Element

  2. Name the data element page.pageInfo.pageName

  3. Use the JavaScript Variable Data Element type to point to a value in Luma’s data layer: digitalData.page.pageInfo.pageName

  4. Check the boxes for Force lowercase value and Clean text to standardize the case and remove extraneous spaces

  5. Leave None as the Storage Duration setting since this value is different on every page

  6. Select Save

    Page Name Data Element

Follow the same steps to create these four additional data elements:

  • page.pageInfo.server mapped to
    digitalData.page.pageInfo.server

  • page.pageInfo.hierarchie1 mapped to
    digitalData.page.pageInfo.hierarchie1

  • user.profile.attributes.username mapped to
    digitalData.user.0.profile.0.attributes.username

  • user.profile.attributes.loggedIn mapped to
    digitalData.user.0.profile.0.attributes.loggedIn

  • cart.orderId mapped to digitalData.cart.orderId (you will use this during the Setup Analytics lesson)

CAUTION
The JavaScript variable data element type treats array references as dots instead of brackets, so referencing the username data element as digitalData.user[0].profile[0].attributes.username will not work.

Create Identity Map Data Element

Next you can create the Identity Map data element:

  1. Go to Data Elements and select Add Data Element

  2. Name the Data Element identityMap.loginID

  3. As the Extension, select Adobe Experience Platform Web SDK

  4. As the Data Element Type, select Identity map

  5. This prompts a screen area to the right within the Data Collection interface for you to configure the identity:

    Data Collection interface

  6. As the Namespace, select the Luma CRM Id namespace that you previously created in the Configure Identities lesson.

    note note
    NOTE
    If you don’t see your Luma CRM Id namespace, verify that you also created it in your default production sandbox. Only namespaces created in the default production sandbox currently display in the namespace dropdown.
  7. After the Namespace is selected, an ID must be set. Select the user.profile.attributes.username data element created earlier in this lesson, which captures an ID when users are logged into the Luma site.

  8. As the Authenticated state, select Authenticated

  9. Select Primary

  10. Select Save

    Data Collection interface

TIP
Adobe recommends sending identities which represent a person, such as Luma CRM Id, as the primary identity.
If the identity map contains the person identifier (e.g. Luma CRM Id), then the person identifier will become the primary identity. Otherwise, ECID becomes the primary identity.

Map data elements to XDM objects

All the data elements you create must be mapped to an XDM object. This object should conform to the XDM schema you created during the Configure a schema lesson.

There are different ways to map data elements to XDM object fields. You can map individual data elements to individual XDM fields or map data elements to entire XDM objects as long as your data element matches the exact key-value pair schema present in the XDM object. In this lesson, you will capture content data by mapping to individual fields. You will learn how to map a data element to an entire XDM object in the Setup Analytics lesson.

Create an XDM object to capture content data:

  1. In the left navigation, select Data Elements

  2. Select Add Data Element

  3. Name the data element xdm.content

  4. As the Extension select Adobe Experience Platform Web SDK

  5. As the Data Element Type select XDM object

  6. Select the Platform Sandbox in which you created the XDM schema in during the Configure an XDM Schema lesson, in this example DEVELOPMENT Mobile and Web SDK Courses

  7. As the Schema, select your Luma Web Event Data schema:

    XDM object

    note note
    NOTE
    The sandbox corresponds to the Experience Platform sandbox in which you created the schema. There can be multiple sandboxes available in your Experience Platform instance, so make sure to select the right one. Always work in development first, then production.
  8. Scroll down until you reach the web object

  9. Select to open it

    Web Object

  10. Map the following web XDM variables to data elements

    • web.webPageDetials.name to %page.pageInfo.pageName%
    • web.webPageDetials.server to %page.pageInfo.server%
    • web.webPageDetials.siteSection to %page.pageInfo.hierarchie1%

    XDM object

  11. Next, find the identityMap object in the schema and select it

  12. Map to the identityMap.loginID data element

  13. Select Save

    Data Collection interface

At the end of these steps, you should have the following data elements created:

CORE Extension Data Elements
Platform Web SDK Data Elements
cart.orderId
identityMap.loginID
page.pageInfo.hierarchie1
xdm.content
page.pageInfo.pageName
page.pageInfo.server
user.profile.attributes.loggedIn
user.profile.attributes.username

With these data elements in place, you are ready to start sending data to Platform Edge Network via the XDM object by creating a rule in tags.

Next: Create a rule in tags

NOTE
Thank you for investing your time in learning about Adobe Experience Platform Web SDK. If you have questions, want to share general feedback, or have suggestions on future content, share them on this Experience League Community discussion post
recommendation-more-help
8cbc0fd8-ca1d-433b-9c3d-bc3f113347d4