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.
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.
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.
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:
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:
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.
At the end of this lesson, you are able to:
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
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.
Before you begin creating the XDM object, create the following set of data elements mapping to the Luma demo site data layer:
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)
Name the data element page.pageInfo.pageName
Use the JavaScript Variable Data Element type to point to a value in Luma’s data layer: digitalData.page.pageInfo.pageName
Check the boxes for Force lowercase value and Clean text to standardize the case and remove extraneous spaces
Leave None
as the Storage Duration setting since this value is different on every page
Select Save
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)
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.
Next you can create the Identity Map data element:
Go to Data Elements and select Add Data Element
Name the Data Element identityMap.loginID
As the Extension, select Adobe Experience Platform Web SDK
As the Data Element Type, select Identity map
This prompts a screen area to the right within the Data Collection interface for you to configure the identity:
As the Namespace, select the Luma CRM Id
namespace that you previously created in the Configure Identities lesson.
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.
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.
As the Authenticated state, select Authenticated
Select Primary
Select Save
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.
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 capture 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:
In the left navigation, select Data Elements
Select Add Data Element
Name the data element xdm.content
As the Extension select Adobe Experience Platform Web SDK
As the Data Element Type select XDM object
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
As the Schema, select your Luma Web Event Data
schema:
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.
Scroll down until you reach the web
object
Select to open it
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%
Next, find the identityMap
object in the schema and select it
Map to the identityMap.loginID
data element
Select Save
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.
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