How to use the Web API tile with Google APIs, such as Google Analytics
This article covers how to use the Web API tile to query data from Google APIs, such as Google Analytics, and display this data in Dashboard Server. For more information see How to use the Web API tile
Prerequisites
- A Google project account and account, such as Google Analytics.
- If you use a proxy server you may need to configure the proxy to allow the Web API tile to communicate with the Google APIs. See How to configure Dashboard Server to use a proxy
Creating a new provider for Google APIs in Dashboard Server
Adding a particular Google API provider is a one-time configuration task, and once you have that Google API provider configured you can use it with multiple tiles.
See How to add a Google API provider
Configuring the Web API tile
The walkthrough below takes you through configuring a simple scalar tile to show the number of pageviews using Google Analytics.
This walkthrough is specific to Google Analytics, but the same principle can be applied to any of the Google APIs.
Walkthrough: Configuring the Web API tile for Google Analytics
- Create a new dashboard and click on the Web API tile.
- Select Web API (Scalar). The Web API (Scalar) tile is designed to show a single value, such as the number of pageviews. Web API (Grid) is for showing a table of data.
- Leave the scope as it is and click next.
In the provider section select the provider that you created earlier, for example GoogleAnalytics
Next you need to find the correct URL to put in the http modeURL box for Google Analytics:
- In a separate tab browse to the Google Analytics Query Explorer
- Select your Account, Property, and View.
- Under metrics, start typing
pageviews
and select Page Views (ga:pageviews) - Click Run Query
Copy the URL (minus the
https://www.googleapis.com/
) from the API Query URI section, so you have something like the following:/analytics/v4/data/ga?ids=ga%3A5###ACCOUNTID###&start-date=30daysAgo&end-date=yesterday&metrics=ga%3Apageviews
- Paste this URL into the http modeURL box on your Dashboard Server dashboard.
- Leave the headers & data section as it is, and click on to the response data section.
In the response data section, paste
rows.0.0
into the key path box.- In the scalar section, paste
pageviews
into the unit box. Click done