Google Analytics provides great real-time and historical reports for websites, and with WSO2 API Cloud, you can easily get them to report your REST API usage as well.
To do that you simply have to:
Create a tracking ID in Google Analytics.
Configure WSO2 API Cloud to report to Google Analytics and provide the ID.
See real-time and historical API usage reports.
Let’s go through all of these steps in details.
1. Create a Tracking ID in Google Analytics
This is not really specific to WSO2 API Cloud in any way. You basically create a Google Analytics account like you normally would.
1a. Go to the Google Analytics homepage and log in or sign up.
1b. Click the Admin tab.
1c. From the Accounts dropdown, select Create new account.
1d. Provide the name of the account and site as you see fit. For the website URL, either provide the custom URL that you have configured in API Cloud or just
gateway.api.cloud.wso2.com if you have not done so.
1e. Click the Get Tracking ID button and accept terms and conditions, and Google Analytics will get you to the Tracking ID page of the new account. Right at the top of the page, it will have the ID that you need, i.e., UA-12345678-9.
2. Hook Up WSO2 API Cloud and Google Analytics
2a. From your API Publisher view, copy your domain-qualified ID that is displayed in the top-right corner.
2b. Go to advanced Gateway admin console here.
2c. Sign in with the domain-qualified name that you got in Step 1 and your regular password.
2d. In the left-hand pane, click Resources/Browse.
2e. Browse to
2f. Click edit as text.
2g. Change false to
true, copy and paste the
TrackingID that you got when setting up the Google Analytics account, and click Save Content:
That is it. Now all API calls for your APIs get registered in Google Analytics.
3. Enjoy Google Analytics Reports for APIs
Once the configuration changes go into effect, your usage data will start showing up in Google Analytics reports.
Real-time report shows subscribers invoking your API right now
Behavior reports can show trends over time, popular REST paths, and so on
And of course, you can use various Google Analytics functionality to work with trends, grouping, custom reports, filtering, and so on.