Rules and XDM events
Prerequisites for this tutorial
Before starting this tutorial, please read and follow the steps in the sample XDM implementation tutorial, including downloading the sample application and setting up the required fields.
Attach data to XDM events
Update the Product reviews schema
In the browser, navigate to Adobe Experience Platform and login with your credentials.
Update the previously created
Product reviewsschema created by adding two new fields.From the left panel, select
Schemasand then select theProduct reviewsschema you have created for the previous assignment.Select the
Product reviewfield group.Select the plus icon
+next to the schema name and add the following fields. SelectApplyafter each field added.Field name Display name Type Required ratingSourceRating SourceStringNoratingDateRating DateDateTimeNoSelect
Saveto update the schema.
Create a mobile rule in the Data Collection UI
- Navigate to the Data Collection UI and select the mobile property you created in the previous assignments.
- Select
Extensionsfrom the left panel and update theAdobe Experience Platform Edgeextension to latest version. - Select
Data elementsfrom the left panel and the following data elements:- Create
App IDdata element:- Select the
Create New Data Elementbutton. - Select the
Mobile CoreExtension andApp IDData Element Type. - Set the name for this data element to
App IDand clickSave.
- Select the
- Create
Operating system versiondata element:- Select the
Add Data Elementbutton. - Select the
Mobile CoreExtension andOS VersionData Element Type. - Set the name for this data element to
Operating system versionand clickSave.
- Select the
- Create
Event timestampdata element:- Select the
Add Data Elementbutton. - Select the
Mobile CoreExtension andAdobe Experience Platform TimestampData Element Type. - Set the name for this data element to
Event timestampand clickSave.
- Select the
- Create
- Select
Rulesfrom the left panel and create the following rule:- Select
Create New Rule.
- Select
- Select the
+ Addbutton in the Events section.- Select
Adobe Experience Platform Edgefor Extension.- Select
AEP Request Event. - Select the
+button to Add XDM Event Type. - Select
XDM Event Type equals product.review. - Select
Keep Changes.
- Select
- Select
Select the
+ Addbutton in the Actions section.Select
Mobile Corefrom the Extensions drop-down andAttach Dataas Action type.In the JSON Payload box, add the following content and modify
_tenantIdto the organization identifier found in theProduct reviewsschema:Copied to your clipboard{"xdm": {"_tenantId": {"ratingDate": "{%%Event timestamp%%}","ratingSource": "MobileApp {%%App ID%%} OS {%%Operating system version%%}"}}}Note that the previously created three data elements are used here to populate the
ratingDateandratingSourceXDM fields.- Select
Keep Changes. - Set a name and click
Saveto keep the rule.
- Select
Publish the new data elements and rule created:
- Select
Publishing Flowfrom the left panel. - Select the development library and click
+ Add All Changed Resources. - Select
Save & Build for Development.
- Select
Tag rules for mobile properties are executed on the client-side mobile application by the Platform Rules Engine extension.
Test with the sample application
Run the Sample app in a simulator or a device and generate product review XDM events:
- In the sample app, navigate to the Edge tab.
- Select a product, add the review information and click
Submit Review. - In the console log search for this log message -
Attaching event data(iOS) /New EventData for Event(Android) and check thatratingDateandratingSourcewere attached correctly. - Verify if the logging messages are intuitive and descriptive for the use-case you are testing.
Validate the event data with AEP Assurance
Connect to an Assurance Session to inspect that the Adobe Experience Platform Request Event has the correct data. To set up an Assurance session with the Sample app, follow the steps in the using Adobe Experience Platform Assurance guide.
- Once connected to Assurance, search for the Adobe Experience Platform Request Event in your session.
- Check that the XDM data for the
product.reviewevent is correctly updated with the two new fieldsratingDateandratingSource.
Extra credit: Update rule/add new rule of your choice
Add a new rule in the Data Collection UI or update the one created in the previous steps. Then validate that the rule was correctly executed for your use case using Adobe Experience Platform Assurance and/or Mobile SDK logging.
Next steps
Find more details about the Adobe Experience Platform Mobile SDK Rules Engine and the supported rule types, please read the Rules Engine documentation and the Rules Engine GitHub.
For more rules examples in the Data Collection UI, see the following links: