• Resources
    • Documentation
    • Knowledge Base
    • Forum
    • Webinars
    • Courses
    • FAQ
    • Changelog
    • Blog
    • Swag Shop
  • Marketplace
  • Access Playground
  • Login
  • Resources
    • Documentation
    • Knowledge Base
    • Forum
    • Webinars
    • Courses
    • FAQ
    • Changelog
    • Blog
    • Swag Shop
  • Marketplace
  • Access Playground
  • Login
home/Knowledge Base/Analytics/App Usage Insights with SAP Web Analytics

App Usage Insights with SAP Web Analytics

191 views 2

Written by chris
June 23, 2021

Why Web Analytics for Business Apps?

If you want to gather Usage data for your business apps, Web Analytics Software provides useful insights and answers to questions like

  • How many Users are using the App?
  • What is the Users Average Visit Duration?
  • Where do User come from (geographically)?
  • What End-Devices is your App used with?
  • What actions were done by Users within your Apps?
  • How can individual Event within the App be tracked?
  • … and much more

To define performance and success metrics for your business apps  gives you the opportunity to track, measure and report Key Performance Indicators (KPI) that fuel the Return on Investment of your App.

Prerequisites

  • Simplifier Server with a Business App that you want to get Usage Insights on
  • Web Analytics Software e.g. Matomo, Google Analytics, SAP Web Analytics or similar
  • In this example we will look at SAP Web Analytics, which is a Cloud Service offered by SAP Business Technology Platform that provides lots of Insights for Web / Mobile Application Usage.

For more information on SAP Web Analytics please have a look at the SAP Web Analytics and Create Custom Reports for SAPUI5 Apps

Step 1 – Get the tracking Code

Login to SAP Business Technology Platform and follow the Tutorial from the SAP Developer Page

After successful setup of SAP Web Analytics and your Application you can acquire the JS Tracking Code. The Tracking code looks like this:

 

<script>
var swa = {
pubToken: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
baseUrl: 'https://events.web-analytics.cfapps.eu10.hana.ondemand.com/tracker/',
owner: null 
//set this to a function that returns the identifier of the tracked user
};
(function(){
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.defer=true; g.async=true; g.src=swa.baseUrl+'js/track.js';
s.parentNode.insertBefore(g,s);
})();
</script>

We will copy this code to the Clipboard and create a new Client-Side Business Object on a Simplifier Server. Let’s call it “SAP_WebAnalytics”. Now we create a new function within the Business Object called “initTracker”.  We will need to Input Parameters named “pubToken” and “baseUrl”  of type “String” that we will use within our function’s code:

Next up we will paste in the Tracking Code that we copied earlier without the script tags which will loke like this:

Now we will replace the attributes “pubToken” and “baseUrl” with our previously created input parameters. Input parameters of Client Side Business Objects can be accessed via “oPayload.nameofParameter” so in our case: oPayload.pubToken and oPayload.baseUrl

Also we will attach the swa variable from the Tracking Code to the window object.

window.swa = {
pubToken: oPayload.pubToken,
baseUrl: oPayload.baseUrl,
owner: null
//set this to a function that returns the identifier of the tracked user
};
(function(){
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.defer=true; g.async=true; g.src=swa.baseUrl+'js/track.js';
s.parentNode.insertBefore(g,s);
})();

We can now set the input parameters value to our pubToken and the baseUrl of SAP Web Analytics:

Within our App that we want to gather Usage Statistics for we simply call the “initTracker” function of our Business Object “onInit” of our first Screen to initalize the tracker:

Now that we have initialized the Tracking Code, our Application will be tracked on the SAP Web Analytics Dashboard

Step 2 – Download Sample Business Object from Marketplace

Download Sample Business Object

Tags:Web AnalyticsMatomoTracking

Was this article helpful?

2 Yes  No
Related Articles
  • App Usage Insights with Matomo Web Analytics
Leave A Comment Cancel reply

You must be logged in to post a comment.

Latest Articles
  • Process Designer: Keeping an overview
  • Simplifer setup with recommended environment using docker-compose
  • Logs and Monitoring in Simplifier
  • Contact | Imprint | Privacy | © 2021 Simplifier AG. All Rights Reserved.