Collect and map Analytics data
Learn how to map mobile data to Adobe Analytics.
The event data which you collected and sent to Platform Edge Network in earlier lessons is forwarded to the services configured in your datastream, including Adobe Analytics. You map the data to the correct variables in your report suite.
Prerequisites
- Understanding of ExperienceEvent tracking.
- Successfully sending XDM data in your sample app.
- An Adobe Analytics report suite that you can use for this lesson.
Learning objectives
In this lesson, you will:
- Configure your datastream with the Adobe Analytics service.
- Understand automatic mapping of Analytics variables.
- Set up processing rules to map XDM data to Analytics variables.
Add Adobe Analytics datastream service
To send your XDM data from the Edge Network to Adobe Analytics, you configure the Adobe Analytics service to the datastream you set up as part of Create a datastream.
-
In the Data Collection UI, select Datastreams and your datastream.
-
Then select Add Service.
-
Add Adobe Analytics from the Service list,
-
Enter the name of the report suite from Adobe Analytics that you want to use in Report Suite ID.
-
Enable the service by switching Enabled on.
-
Select Save.
Automatic mapping
Many of the standard XDM fields are automatically mapped to Analytics variables. See the full list here.
Example #1 - s.products
A good example is the products variable which can’t be populated using processing rules. With an XDM implementation, you pass all the necessary data in productListItems
and s.products
are automatically populated via Analytics mapping.
This object:
"productListItems": [
[
"name": "Yoga Mat",
"SKU": "5829",
"priceTotal": "49.99",
"quantity": 1
],
[
"name": "Water Bottle",
"SKU": "9841",
"priceTotal": "30.00",
"quantity": 3
]
]
results in:
s.products = ";5829;1;49.99,9841;3;30.00"
productListItems[].SKU
and productListItems[].name
both contain data, the value in productListItems[].SKU
is used. See Analytics variable mapping in Adobe Experience Edge for more information.Example #2 - scAdd
If you look closely, all events have two fields value
(required) and id
(optional). The value
field is used to increment the event count. The id
field is used for serialization.
This object:
"commerce" : {
"productListAdds" : {
"value" : 1
}
}
results in:
s.events = "scAdd"
This object:
"commerce" : {
"productListAdds" : {
"value" : 1,
"id": "321435"
}
}
results in:
s.events = "scAdd:321435"
Validate with Assurance
Using the Assurance you can confirm that you’re sending an experience event, the XDM data is correct and the Analytics mapping is happening as expected.
-
Review the setup instructions section to connect your simulator or device to Assurance.
-
Send a productListAdds event (add a product to your basket).
-
View the ExperienceEvent hit.
-
Review the XDM portion of the JSON.
code language-json "xdm" : { "productListItems" : [ { "SKU" : "LLWS05.1-XS", "name" : "Desiree Fitness Tee", "priceTotal" : 24 } ], "timestamp" : "2023-08-04T12:53:37.662Z", "eventType" : "commerce.productListAdds", "commerce" : { "productListAdds" : { "value" : 1 } } // ...
-
Review the analytics.mapping event.
Note the following in the Analytics mapping:
- events are populated with
scAdd
based oncommerce.productListAdds
. - pl (products variable) are populated with a concatenated value based on
productListItems
. - There is other interesting information in this event including all the context data.
Mapping with Context Data
XDM data forwarded to Analytics gets converted into context data including both standard and custom fields.
The context data key is constructed following this syntax:
a.x.[xdm path]
For example:
// Standard Field
a.x.commerce.saveforlaters.value
// Custom Field
a.x._techmarketingdemos.appinformation.appstatedetails.screenname
_techmarketingdemos
is replaced with your Organization’s unique value.To map this XDM context data to your Analytics data in your report suite, you can:
Use a field group
-
Add the Adobe Analytics ExperienceEvent Full Extension field group to your schema.
-
Build XDM payloads in your app, conforming to the Adobe Analytics ExperienceEvent Full Extension field group, similar to what you have done in the Track Event Data lesson, or
-
Build rules in your Tags property that use rule actions to attach or modify data to the Adobe Analytics ExperienceEvent Full Extension field group. See for more details Attach data to SDK events or Modify data in SDK events.
Merchandising eVars
If you are using merchandising eVars in your Analytics setup, for example to capture the color of products, like &&products = ...;evar1=red;event10=50,...;evar1=blue;event10=60
, you have to extend your XDM payload that you defined in Track event data to capture that merchandising information.
-
In JSON:
code language-json { "productListItems": [ { "SKU": "LLWS05.1-XS", "name": "Desiree Fitness Tee", "priceTotal": 24, "_experience": { "analytics": { "events1to100": { "event10": { "value": 50 } }, "customDimensions": { "eVars": { "eVar1": "red", } } } } } ], "eventType": "commerce.productListAdds", "commerce": { "productListAdds": { "value": 1 } } }
-
In code:
code language-swift var xdmData: [String: Any] = [ "productListItems": [ [ "name": productName, "SKU": sku, "priceTotal": priceString, "_experience" : [ "analytics": [ "events1to100": [ "event10": [ "value:": value ] ], "customDimensions": [ "eVars": [ "eVar1": color ] ] ] ] ] ], "eventType": "commerce.productViews", "commerce": [ "productViews": [ "value": 1 ] ] ]
Use processing rules
Here is what a processing rule using this data might look like:
-
You Overwrite value of (1) App Screen Name (eVar2) (2) with the value of a.x._techmarketingdemo.appinformation.appstatedetails.screenname (3) if a.x._techmarketingdemo.appinformation.appstatedetails.screenname (4) is set (5).
-
You Set event (6) Add to Wishlist (Event 3) (7) to a.x.commerce.saveForLaters.value(Context) (8) if a.x.commerce.saveForLaters.value(Context) (9) is set (10).
Additional information about processing rules and context data can be found here.
screenName
field in the tutorial, it is highly recommended to map screen name to Page Name in a processing rule.Thank you for investing your time in learning about Adobe Experience Platform Mobile 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.
Next: Send data to Experience Platform