Skip to Content
Product Information
Author's profile photo Rashmi Angadi

How to consume Web Analytics as a SAP BTP API Service

Introduction

 

SAP Web Analytics is a Software-as-a-service (SaaS) on the Business Technology Platform(BTP). The application lets you collect, report, and analyse 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 organisational goals, drive strategy, and improve the overall user experience of your web applications.

Some the external applications want to consume the Web Analytics API’s for their integration reasons or for reporting purposes. These applications do not want to perform actions on  UI instead they want to call the exposed API’s.

Applications not part of webanalytics organization wants to access these api’s securely so how is this possible?. Web Analytics API’s are secured one and only authorized person can access the API’s.

Business Technology Platform provides a concept of broker which helps the applications by providing client id and certificate to access the webanalytics API’s in case of grant type client credentials or user token in case of user flow.

For the above reason Web Analytics exposed some of its API’s which can be consumed by application by creating an instance of Web Analytics API Service.

 

How to create an instance of Web Analytics API Service

  • Login to your subaccount on Business Technology platform and go to “Service Marketplace”. Subscribe to “Web Analytics” SaaS application(this is the prerequisite to create webanalytics api service instance and also the account should be CPEA enabled to see the Web Analytics tile by default)
  • Go to desired space in the dedicated subaccount where “Web Analytics” is subscribed” and go to Service Market place and search for “SAP Web Analytics API Service” tile.
  • Create an instance of the above service by selecting the plan as “standard” and giving desired name. If you want the customer admin access do not add any JSON as input just create and save. If you want Space Admin flow ie access to specific Web Analytics tenant then pass the JSON as below.(one or more tenants can be passed.{“SWATENANT”:
    [
    
    {"tenantId":"7386453a-769b-45d5-9327-b72d321c8268"},
    
    {"tenantId":"58dbe24e-9925-4c9f-a1ce-96e8729eb229"}
    
    ]
    
    }
  • Once instance is created create the service key and fetch the client id, certurl, certificate, key and api url and then access the api’s by using oAuth2 flow.

 

 

Service%20Key%20Properties

Service Key Properties

 

Once the properties are fetched generate the JWT token using certurl,key,certificate and client id.

Use the JWT Token generated and pass it to header with “Authorization” Bearer and JWT Token value and call exposed SWA API’s.

All the exposed API’s are available here

https://api.sap.com/package/SAPWebAnalytics/rest

 

Conclusion

After going through this blog you will be able to use the Web Analytics Exposed API’s using Web Analytics API service instance for the application integration scenario.

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.