Introduction
Almost all of the SAP S4 on Premise customers want to see how is the usage of their applications, which are the regions the applications widely used, what is the performance over time, on which browsers it is mostly used and what is the trend of visitors, from which external links people are using applications and so on.“SAP Web Analytics” is the desired solution to achieve the above scenarios.
SAP Web Analytics is a Software-as-a-service (SaaS) on the Business Technology Platform(BTP). The application lets you collect, report, and analyze your website usage data that helps you to identify meaningful patterns from various digital channels. The application can offer insights on how well your websites perform in key channels. These insights can lead you to implement critical improvements that help you optimize web usage to measure organizational goals, drive strategy, and improve the overall user experience of your web applications.
This solution is integrated with Fiori Launchpad which enables the FLP owner to do analytics on their applications.
1. Web Analytics Set up
Follow the below steps to set up “SAP Web Analytics” and the S4 system
- Go to Subscriptions menu in your desired subaccount on the Business Technology Platform and subscribe to “Web Analytics”. Web Analytics is hosted both on AWS and Microsoft azure in different regions like Europe,Australia,Singapore,US East,US West,Japan.
- Once subscribed Go to Role collections menu under Security and create a Role Collection and then edit the Role collection created and add the role that has _WebAnalyticsAdmin and assign users to the role collection. This step enables the users added to this role to act as Customer Admins who can create “Web Analytics” specific tenants called Spaces.
- Now click on “Go to Application” on the “Web Analytics” tile and land to the Space Management page. Click on Add Space and create a new space and add the required users to the space who can add as “Space Admins”.
Note: User Id here can be email address or the employee id (if custom IDP) and user name is the Employee Name.
- Go and create site now in “Site Management”. Enter the website as the domain name of your FLP application
Once the site is created a pubtoken and baseurl are generated which need to be copied to s4 system entries.
2. On Premise System Set up
Check the ui5 version of your FLP by typing ui.version on the Console option of your developer tools.
- Login to your On Premise System and enter the transaction code
/n /UI2/FLP_CONF_DEF and click on “Define LaunchPad Plug Ins”
Create a new Plugin here giving unique plugin id and description. If ui5 version is greater than or equal to 1.77.0 then give UI5 Component Id as “sap.webanalytics.core.SAPWEBANALYTICSFLPPLUGIN” and save.
- If version is lesser than “1.77.0” then set up your code as below in any of the IDE ie WEB IDE or Business Application Studio whichever is integrated with your onpremise system. Use the code from screen shots and add to component.js of the application and deploy to SAP ABAP repository from webide using UI and Business studio using abap-deploy command.
- Replace SWAFLPPlugin with the UI5 Component Id which you give while creating the launchpad plugin and the url has to /sap/bc/ui5_ui5/sap/Name of the application you deploy to ABAP Repository. Save the Plugin and verify its status which has to be active.
- Add the properties to the plugin by selecting the created plugin in last step and then click on “Define Properties”.
SWA_BASE_URL and SWA_PUB_TOKEN are the mandatory properties to be created.
Note: While adding the properties “Property Path” is mandatory which can be a value of string type.
Table 1.0 FLP Snippet Properties
Property | Description | Data type and values |
SWA_BASE_URL |
This is the tracker url generated from snippet when a site is created. | String |
SWA_PUB_TOKEN | This is the unique generated if from snippet when a site is created. | String |
SWA_CONSENT_STYLE | Option to display the consent text in the form of banner,pop up or banner at the bottom | String(banner,bannerbottom,popup) |
SWA_CONSENT_LANGUAGE | If default consent banner is selected user can give the language code for this value and then banner text appears in the defined language. |
String(ar,bg,cs,ca,fr,hi,en_US, en_GB,de,el,es, zh_CN,zh_TW,vi,uk,th,tr,sh,ro,kk,hu,nl) |
SWA_PRIVACY_LINK | Privacy Statement of the site can be stored in a url which can be passed here so that it gets appended at the end of consent text in banner or pop up. | String(It has to be a url) |
ANON_TRK_ON_DENY | To Provide users an option of anonymous tracking. | Boolean(true/false) true for Anonymous Tracking |
SWA_USER | If the information of the user who is being tracked is required this field is necessary. | Boolean ie true/false |
- Open the transaction /UI2/FLP_CUS_CONF and then assign the values to the created properties by adding new entries.
Copy the pubtoken and base url from site snippet properties(site management of “Web Analytics”) and paste them in SWA_PUB_TOKEN and SWA_BASE_URL respectively.
Alternatively other attributes specified in the above table 1.0 FLP Snippet Properties can be set according to the need.
Once everything is set open the FLP and enjoy “Web Analytics”.
3. Troubleshooting Tracking in FLP
If usage is not being tracked even after setup open the “Developer tools” and try the below things.
- Check if any console errors are present and try to resolve if syntax errors.
- Go to Network tab reload the browser and check if “Component.js” is loading or not. If not check the path of plugin in s4 system and check if plugin is active.
- Verify if preferences api is returning 200 OK response and if response says “Invalid pub token” Kindly make sure you copied the right pub token in the entry SWA_PUB_TOKEN.
- If track.js is loaded but tracking is not working then need to check the site settings, site domain or is it a gateway system.