Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
MarcoEidinger
Product and Topic Expert
Product and Topic Expert
750

Motivation



Do you develop mobile applications with SAP Cloud Platform SDK for iOS and Android and do you wonder how your users are actively using your apps? Would you like to get more insights about the most popular screens or actions within your apps?

In this article, I will help you to understand

  • how to enable this feature in the server (step 1)

  • how to get consent from each user in your mobile app (step 2)

  • how you, as an app developer, can instrument your apps to capture user relevant information easily with the SDK (step 3) and

  • how to analyze this information with the built-in analytical capabilities of Mobile Services (step 4)


I assume you already have basic knowledge about SAP Cloud Platform Mobile Services and have access to an account. If not you can get more details and instructions about how to request a trial version in this tutorial.

Step 1: Enable Client Usage in Mobile Services




Have you added Mobile Client Usage and User Feedback as a feature to your application in the Mobile Service Cockpit?




Great, you are nearly done. Just one more click is needed to enable the client usage.







Step 2: Ask for user's consent


For legal or transparency reasons you probably want your users to explicitly opt-in into this data collection.

Luckily the SAPFioriFlows framework provides UsageCollectionConsentStep and this step can be included in the onboarding flow. It will request the user's consent for usage data.



You don't have to write your own screen!

The relevant code gets automatically added when you use SAP Cloud Platform SDK for iOS Assistant to generate your XCode project.

Step 3: Capture information with the SDK


The SAPFoundation framework provides a singleton to start automatic data collection
do {
try UsageBroker.shared.start()
} catch {
print("Failed to initialize usage collection.", error: error)
}


Again, If you used the SAP Cloud Platform SDK for iOS Assistant then the relevant code was generated for you. You'll find the relevant code in your AppDelegate file.

Once started the SDK will collect device, memory, network, and location-related information automatically (if user consent is given)



OS/App lifecycle events (like onEnterForeground or onEnterBackground) are automatically collected as well.





But how to log events related to your screens and actions?


The SAPCommon frameworks provide a easy but powerful AP with SAPcpmsUsage


// Reports a sessionStart event (and standard app usage information like deviceIdentifier, deviceModel, systemName and systemVersion)
SAPcpmsUsage.sessionStart(applicationIdentifier: Bundle.main.bundleIdentifier!)

// Logging when views display
SAPcpmsUsage.logBehaviorEvent(behaviorEvent: .viewDisplayed, viewIdentifier: "Products Listing Screen")

// Logging user interactions within an app
SAPcpmsUsage.logBehaviorEvent(behaviorEvent: .userInteraction, viewIdentifier: "Products Listing Screen", elementIdentifier: "Refresh Button")

SAPcpmsUsage.logBehaviorEvent(behaviorEvent: .userInteraction, viewIdentifier: "Products Listing Screen", elementIdentifier: "Products Table", action:"Row Selected", value: "Product 0815")

SAPcpmsUsage.sessionEnd()




Don't forget to upload the captured information to Mobile Services !!!
// Upload usage report to server
UsageBroker.shared.upload()


Step 4: Analyze the information



User Data is classified in


  • Sessions

  • Demographics

  • Behavior


and each category has its views with dimensional drill-downs.

These built-in analytical capabilities are available out-of-the-box!!


Sessions illustrate how often and how long your apps are used. It also provides helpful information on what kind of devices run your apps.



Demographics will provide further information where in the world your users are working with your apps.

And maybe most importantly Behavior will tell you which screens and actions are used the most.



For more details please have a look at the related official documentation for NEO or Cloud Foundry

Please note: in case your business requires an analytical analysis that cannot be represented by the built-in charts then you can export the collected information and do it yourself. I will provide another article focusing on this aspect in the near future.

Further information


I hope that you gained a better understanding of SAP's capabilities regarding mobile client usage.

I can also recommend this great article about client usage. It is written for developers using the SAP Cloud Platform SDK for Android while my article was focusing on iOS developers.
3 Comments