AEP Mobile SDK – How to Implement stand-alone Adobe Analytics using Datastream

The AEP Mobile SDK is the relatively new way of leveraging the edge or datastream functionality within the AEP space. Though the capabilities do offer a lot but for an architect who is not a full stack developer, the official documentation leaves a few gaps in how the tagging instructions should come together and how those would be leveraged in AEP through the use of datastream. This article is an attempt to bring everything at one place so that you, the reader, doesn’t have to piece it all together, the way I had to!

One To Rule Them All : Datastream Forwarding Data Server-Side

Broadly, here are the steps involved in sending data to Adobe datastream and then further on to different systems. In this article, we would just focus on sending data to Adobe Analytics but using the sendEvent API instead of the earlier trackState and trackAction methods.

  • Creating a schema within AEP to house the clickstream data. Ensure to include the Adobe Analytics ExperienceEvent Template field group as part of the schema. This field group contains all your usual analytics custom dimensions and metrics, i.e, eVars, props, events etc.
  • Based on the above schema, create a dataset to house the data that you intend to send through in later steps. This step is only required if you intend to store data in the AEP datalake else if you intend to use datastream only to send data to AA then this step can be ignored.
  • Switch to data collection interface, and create a mobile property within Tags.
  • Still in the data collection interface, go to datastreams section and create a new datastream. Specify the event schema that we created in Step 1. Add two services to it, Adobe Experience Platform and Adobe Analytics. In the AEP mapping, you would need to specify the event dataset that you intend to use while sending data. You would also need to put in the report suite id of the AA RS you want to send the data to in AA service mapping.
  • Once the stream is created, go back to the property created in step 3 above. Install two extensions, Identity and Edge Network.
  • Within edge network extension, select the datastream for different environments – production, staging, development.
  • Attach all your changes to a working library and build and attach it to the development environment.
  • Get the SDK installation instructions from the environment section of the property and depending on whether you are using Android or IOS to test this out, follow the step by step guide to register your SDK and extensions.
  • Once the above is done, we need to ensure that the payload we are sending through is in the XDM compatible format and follows the schema structure mapped to the datastream in Step 4 else your data would not show up in AA and would show up in AEP partially.
  • To ensure that the payload is XDM compatible, we would make use of Hashmaps in this example and then add the nested objects into a final map, eventually using the sendEvent API method to send it through to AEP through edge.
Map<String, Object> reviewXdmData = new HashMap<>();
               reviewXdmData.put("prop1", "Medium Article Demo");
               Map<String, Object> propsData = new HashMap<>();
               propsData.put("props",reviewXdmData);

               Map<String,Object> cdData = new HashMap<>();
               cdData.put("customDimensions",propsData);

              Map<String,Object> analyticsData = new HashMap<>();
               analyticsData.put("analytics",cdData);

               Map<String, Object> expData = new HashMap<>();
               expData.put("eventType", "MyFirstXDMExperienceEvent");
               expData.put("_experience", analyticsData);

               Map<String, Object> screenViewData = new HashMap<>();
               screenViewData.put("value",1);

               Map<String, Object> scView = new HashMap<>();
               scView.put("pageViews",screenViewData);
               scView.put("name","Testing AEP DataStream");

               Map<String, Object> screenDetails = new HashMap<>();
               screenDetails.put("webPageDetails",scView);


               Map<String, Object> screenObj = new HashMap<>();
               screenObj.put("web",screenDetails);

               Map<String, Object> finalObj = new HashMap<>();
               finalObj.putAll(expData);
               finalObj.putAll(screenObj);


               ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
               .setXdmSchema(finalObj)
               .build();

  • Once you have made your first hit from your emulator in the IDE of your choice, you would see something similar to the below structure in your logs ( I am using Android Studio)

The above logs show that the data was sent through to AEP datastream. Next, you can verify that data in AA report suite. If you have used a prop or a pagename in your test setup, you can see the data flowing through in real time reports within AA. Snapshot from my AA sandbox RS below:

You can also verify the data showing up in AEP, with the ECID value from the logs in Step 11 and looking for the profile. The events tab would show up the events, along with the lifecycle metric events like launch, close etc. Snapshot from my sandbox provided below for reference. Sending data to AEP dataset is optional if you are just using datastream to send data to AA.

This one is a longer post than my previous ones as I wanted to put everything that you would need to set up the SDK in one place instead of looking all over the internet to put pieces together.

Now that you know how to go about doing it, framing tagging instructions for the dev team would be much easier. Just need to ensure your payload is XDM compliant and rest would all fall in place.

Feel free to leave your thoughts in the comments.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *