Data Prep for Data Collection

Use Data Prep, an Adobe Experience Platform service, to map, transform, and validate data to and from Experience Data Model (XDM). When configuring an Experience Platform-enabled datastream, you can use Data Prep capabilities to map your source data to XDM when sending it to the Adobe Experience Platform Edge Network.

All data sent from a web page must land in Experience Platform as XDM. You have three ways to translate data from an on-page data layer to the XDM accepted by Experience Platform:

  1. Reformat the data layer into XDM on the web page itself.
  2. Use the Tags built-in data elements functionality to reformat a web page’s existing data layer format into XDM.
  3. Reformat a web page’s existing data layer format into XDM via the Edge Network, using Data Prep for Data Collection.

This guide covers the third option.

When to use Data Prep for Data Collection when-to-use-data-prep

Data Prep for Data Collection is useful in two situations:

  1. The website has a well-formed, governed, and maintained data layer, and you prefer to send it directly to the Edge Network instead of using JavaScript manipulation to convert it to XDM on the page (either via Tags data elements or via manual JavaScript manipulation).
  2. A tagging system other than Tags is deployed on the site.

Send an existing data layer to the Edge Network via Web SDK send-datalayer-via-websdk

The existing data layer must be sent using the data object within the sendEvent command.

If you are using Tags, you must use the Data field of the Send Event action type.

The rest of this guide covers how to map the data layer to XDM standards after it has been sent by the Web SDK.

NOTE
For comprehensive guidance on all Data Prep capabilities, including transformation functions for calculated fields, see the following documentation:

This guide covers how to map your data within the UI. To complete the steps, start the process of creating a datastream up to (and including) the basic configuration step.

For a quick demonstration of the Data Prep for Data Collection process, see the following video:

Provide sample data select-data

Select Save and Add Mapping after completing the basic configuration for a datastream, and the Select data step appears. From here, you must provide a sample JSON object that represents the structure of the data that you plan on sending to Experience Platform.

To capture properties directly from your data layer, the JSON object must have a single root property data. The subproperties of the data object should then be constructed in a way that maps to the data layer properties that you want to capture. Select the section below to view an example of a properly formatted JSON object with a data root.

Sample JSON file with data root
code language-json
{
  "data": {
    "eventMergeId": "cce1b53c-571f-4f36-b3c1-153d85be6602",
    "eventType": "view:load",
    "timestamp": "2021-09-30T14:50:09.604Z",
    "web": {
      "webPageDetails": {
        "siteSection": "Product section",
        "server": "example.com",
        "name": "product home",
        "URL": "https://www.example.com"
      },
      "webReferrer": {
        "URL": "https://www.adobe.com/index2.html",
        "type": "external"
      }
    },
    "commerce": {
      "purchase": 1,
      "order": {
        "orderID": "1234"
      }
    },
    "product": [
      {
        "productInfo": {
          "productID": "123"
        }
      },
      {
        "productInfo": {
          "productID": "1234"
        }
      }
    ],
    "reservation": {
      "id": "anc45123xlm",
      "name": "Embassy Suits",
      "SKU": "12345-L",
      "skuVariant": "12345-LG-R",
      "priceTotal": "112.99",
      "currencyCode": "USD",
      "adults": 2,
      "children": 3,
      "productAddMethod": "PDP",
      "_namespace": {
        "test": 1,
        "priceTotal": "112.99",
        "category": "Overnight Stay"
      },
      "freeCancellation": false,
      "cancellationFee": 20,
      "refundable": true
    }
  }
}

To capture properties from an XDM object data element, the same rules apply to the JSON object, but the root property must be keyed as xdm instead. Select the section below to view an example of a properly formatted JSON object with an xdm root.

Sample JSON file with xdm root
code language-json
{
  "xdm": {
    "environment": {
      "type": "browser",
      "browserDetails": {
        "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36",
        "javaScriptEnabled": true,
        "javaScriptVersion": "1.8.5",
        "cookiesEnabled": true,
        "viewportHeight": 900,
        "viewportWidth": 1680,
        "javaEnabled": true
      },
      "domain": "adobe.com",
      "colorDepth": 24,
      "viewportHeight": 1050,
      "viewportWidth": 1680
    },
    "device": {
      "screenHeight": 1050,
      "screenWidth": 1680
    }
  }
}

You can select the option to upload the object as a file, or paste the raw object into the provided textbox instead. If the JSON is valid, a preview schema is displayed in the right panel. Select Next to continue.

JSON sample of expected incoming data.

NOTE
Use a sample JSON object that represents every data layer element that may be used on any page. For example, not all pages use shopping cart data layer elements. However, include shopping cart data layer elements in this sample JSON object.

Map your data mapping

The Mapping step appears, allowing you to map the fields in your source data to that of the target event schema in Experience Platform. From here, you can configure the mapping in two ways:

IMPORTANT
Data Prep mapping overrides identityMap XDM payloads, which can further impact profile matching against Real-Time CDP audiences.

Create mapping rules create-mapping

To create a mapping rule, select Add new mapping.

Adding a new mapping.

Select the source icon ( Source field selector icon ), and in the dialog that appears select the source field that you want to map in the provided canvas. Once you have chosen a field, use the Select button to continue.

Selecting the field to be mapped in the source schema.

Next, select the schema icon ( Target schema selector icon ) to open a similar dialog for the target event schema. Choose the field that you want to map the data to before confirming with Select.

Selecting the field to be mapped in the target schema.

The mapping page reappears with the completed field mapping shown. The Mapping progress section updates to reflect the total number of fields that have been successfully mapped.

Field successfully mapped with progress reflected.

TIP
If you want to map an array of objects (in the source field) to an array of different objects (in the target field), add [*] after the array name in the source and destination field paths, as shown below.
Array object mapping.

Import existing mapping rules import-mapping

If you have previously created a datastream, you can reuse its configured mapping rules for a new datastream.

WARNING
Importing mapping rules from another datastream overwrites any field mappings that you might have added before the import.

To start, select Import Mapping.

Import Mapping button being selected.

In the dialog that appears, select the datastream whose mapping rules you want to import. Once the datastream is chosen, select Preview.

Selecting an existing datastream.

NOTE
Datastreams can only be imported within the same sandbox. You cannot import a datastream from one sandbox to another.

The next screen shows a preview of the saved mapping rules for the selected datastream. Make sure that the displayed mappings are what you expect, and then select Import to confirm and add the mappings to the new datastream.

Mapping rules to be imported.

NOTE
If any source fields in the imported mapping rules are not included in the sample JSON data that you provided earlier, those field mappings will not be included in the import.

Complete the mapping complete-mapping

Continue mapping the remaining fields to the target schema. While you do not have to map all available source fields, any fields in the target schema that are set as required must be mapped to complete this step. The Required fields counter indicates how many required fields are not yet mapped in the current configuration.

When the required field count reaches zero and you are satisfied with your mapping, select Save to finalize your changes.

The mapping interface showing all required fields successfully mapped with a zero required field count.

Next steps next-steps

This guide covered how to map your data to XDM when setting up a datastream in the UI. If you were following the general datastreams tutorial, you can now return to the step on viewing datastream details.

recommendation-more-help
experience-platform-help-datastreams