Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WSO2 You can configure the API Manager can be configured to track runtime statistics of API invocations through Google Analytics (http://www.google.com/analytics). Google Analytics is a service which 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.1.

  1. 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.

...

  1. Open

...

  1. $APIM_HOME/repository/conf/api-manager.xml. Enable the <GoogleAnalyticsTracking> element and enter the Tracking-ID.

    Code Block
    languagehtml/xml
    <GoogleAnalyticsTracking>
       <!-- Enable/Disable Google Analytics Tracking -->
       <Enabled>false</Enabled>
       <!-- Google Analytics Tracking ID -->
       <TrackingID>UA-XXXXXXXX-X</TrackingID>
    </GoogleAnalyticsTracking>

...

  1. Save the file and restart the API Manager instance.

...

  1. 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

...

  1. Real-Time

...

  1. after logging into their Google Analytics account. Click on this icon and select

...

  1. Overview

...

  1. .

...

  1. Invoke the above API

...

  1. using the embedded WSO2 REST Client (or any third-part rest client such as cURL).

    Real-

...

  1. time statistics

...


  1. This is

...

  1. one invocation of the API. Accordingly, Google Analytics graphs and statistics will be displayed

...

  1. at runtime.

...

  1. This example displays the PageViews per second graph and

...

  1. 1 user as active

...

  1. .
    Image Modified

    Reporting

...

  1. statistics

    Google

...

  1. analytics reporting statistics

...

  1. take more than 24 hours from the time of invocation to populate. Shown below is a sample Dashboard with populated statistics.

    Image Modified

...

  1. There are

...

  1. widgets with statistics related to Audience, Traffic, Page Content, Visit Duration etc. You can add any widget of your preference

...

  1. to dashboard.