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 SquaredUp DS. For more information see How to use the Web API tile.
- 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 SquaredUp DS to use a proxy
Creating a new provider for Google APIs in SquaredUp DS
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.
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
pageviewsand 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:
- Paste this URL into the http modeURL box on your SquaredUp DS 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.0into the key path box.
- In the scalar section, paste
pageviewsinto the unit box.