Google Analytics Tracking for WSO2 API Manager


WSO2 API Manager is a platform for creating, managing, consuming and monitoring APIs. It employs proven SOA best practices to solve a wide range of API management challenges such as API provisioning, API governance, API security and API monitoring.


You can download API Manager latest version from:

http://wso2.com/products/api-manager

and find the online documentation from:

http://docs.wso2.org/wiki/display/AM130/WSO2+API+Manager+Documentation


With WSO2 API Manager 1.3.0 release you can track your API invocations through Google Analytics!

First let me explain you what is google analytics. Google analytics is a service offered by Google which tracks vists to a web site and generates detailed statistics based on those visits.
Now WSO2 API Manager latest 1.3.0 release fascilitates you to integrate with Google Analytics to track run time statistics for API invocations.

Here is the step by step guide to do this.

1. Setup a Google analytics account.

If you already have a google account, Sign-In. Else Create a New Google Account and Sign-In.

Then go to http://www.google.com/analytics/ and Sign-In

Click on the Admin Icon on top right

Then Click Create New Account as highlighted in below image.


Now select 'Web Site' for what would you like to Track and give information about the account as follows. Please note that since we are actually not tracking a site, give any site URL for 'Web Site URL'.


Now Click Get 'Tracking ID' bottom of the page.

Accept the Google Analytics Terms of Service and you will directed to a page with Tracking information.



Now you have sucessfully created your Tracking account and you will need the obtained Tracking-ID for further steps.

2. Enable Google Analytics Tracking in API Manager.

Open API_MANAGER_HOME/repository/conf/api-manager.xml. Locate the and set Enabled to true and enter the Tracking-ID obtained in as follows.


Save the changes to API_MANAGER_HOME/repository/conf/api-manager.xml and restart your API Manager running instance.

Now we have successfully integrated WSO2 API Manager with Google Analytics. Now lets see how we can see the statistics.

3. View Google Analytics statistics.

Real Time Statistics

First create and publish an API. Then through the API store subscribe to that API.

Now go to Google Analytics [http://www.google.com/analytics/] and select the above created 'APISTORESTAT' account from the list of Accounts.

On the appearing page go to 'Home' tab.

Now you will see 'Real-Time' icon in left menu. Click on that and select 'Overview'.

Then invoke/call the above created API through embedded RESTClient or Curl.

Now you will be able to see a hit on 'PageViews' Per second graph and also 'Right Now' users as 1.


Reporting Statistics

Google analytics reporting statistics population takes more than 24hours from the invocation. Therefore to view the statistics on the Dashboard you need to wait!

Here is a sample Dashboard with populated statistics.


Here as you can see there are Widgets with statistics related to Audience, Traffic, Page Content, Visit Duration etc. You can add any widgets for your preference through 'Add Widget'.





Comments

Post a Comment

Popular posts from this blog

PHP-SOAP web service with out a WSDL

Boomi Mapping - Removing special chars from an input

How to add Maven dependency from a relative path referencing a local jar