You can configure the API Manager to track runtime statistics of API invocations through Google Analytics (). Google Analytics is a service that allows you to track visits to a website and generate detailed statistics on them.
This guide explains how to setup API Manager in order to feed runtime statistics to Google analytics for summarization and display.
- Setup a Google Analytics account if not subscribed already and receive a Tracking ID, which is of the format "UA-XXXXXXXX-X". A Tracking ID is issued at the time an account is created with Google Analytics.
Open $APIM_HOME/repository/conf/api-manager.xml. Enable the
<GoogleAnalyticsTracking>element and enter the Tracking-ID.
Code Block language html/xml
<GoogleAnalyticsTracking> <!-- Enable/Disable Google Analytics Tracking --> <Enabled>false</Enabled> <!-- Google Analytics Tracking ID --> <TrackingID>UA-XXXXXXXX-X</TrackingID> </GoogleAnalyticsTracking>
- Save the file and restart the API Manager instance.
- API Manager is now integrated with Google Analytics. A user who has subscribed to a published API through the API Store should see an icon as
Real-Timeafter logging into their Google Analytics account. Click on this icon and select Overview.
- Invoke the above API using the embedded
Real-time statistics (or any third-part rest client such as cURL).
- This is one invocation of the API. Accordingly, Google Analytics graphs and statistics will be displayed at runtime. This example displays the PageViews per second graph and 1 user as active.
Google analytics reporting statistics take more than 24 hours from the time of invocation to populate. Shown below is a sample Dashboard with populated statistics.
There are widgets with statistics related to Audience, Traffic, Page Content, Visit Duration etc. You can add any widget of your preference to dashboard.