How to Connect Klipfolio to RESTful APIs like Google Analytics

If you’ve ever worked in Google Analytics, you’re probably used to exporting data into Excel sheets to do a deeper analysis. I’ll bet you do it regularly, and manually.

If you’re responsible for monitoring and reporting on Web performance, you’re probably also making use of Google Analytics dashboards. Do you find them frustratingly limiting? How many steps does it take you to get to the information you’re looking for?

Speaking of Web performance, how much of the picture does GA capture for you? Do you find yourself in Excel, trying to combine exported GA data with other data sets from Google AdWords, social media and elsewhere to pull together insights?

If you’re facing all or any of these challenges, you may be interested to learn how you can connect Google Analytics’ Core Reporting API with Klipfolio, and use that data to build real-time data visualizations and dashboards that meet your specific reporting needs.

This tutorial will show you how you can push data into Klipfolio from hundreds of APIs, using the Google Analytics Core Reporting API as an example. The best way to follow along with this tutorial is if you have both Google Analytics and Klipfolio accounts. Klipfolio live dashboard

View the live dashboard here

Getting started in Klipfolio

1. Log in or start a free trial at app.klipfolio.com.
2. At the top right corner of your screen, select ‘Library’.

Klipfolio library

3. In ‘Library’, select the ‘Data Sources’ tab.
4. Click ‘Create a New Data Source’.

Create new data source

5. Select ‘Google Analytics’ from the list of Service Connectors, or to make it faster (there are hundreds of data sources in the list), simply search for Google Analytics in the search bar.

Select a service connector

Connecting to Google Analytics

Now that you have selected Google Analytics, you can create your own data source by clicking:  ‘Create a custom Google Analytics data source’. 

create custom google analytics data source

Once your data source has been created, you need to set up the Authentication for it.  To do this, log into your Google account using the Google Analytics OAuth connector.

Google analytics oauth connector

Now that you’re all set up, it’s time to configure a query that will tell the system what Google Analytics data you want from your account. This is what you should now see on your screen:

configure google analytics query

To get started, let’s use Simple Mode. Simple Mode lets you complete your query using drop-down lists. This is great if you aren’t fully comfortable building API queries from scratch, but know what data you want. But even if you’re a pro at building queries, you can still use Simple Mode to get your query started faster, and then customize it in Advanced Mode. 

simple mode query

Now that you’re on Simple Mode view, let’s complete the query.

Take a look at ‘Profile ID’. This is an important piece of information that you need to get from your Google Analytics account. If you don’t know where it is, click ‘Where do I find my Profile ID?’ and you will get detailed steps in Klipfolio’s sidebar help. Once you’ve found your Profile ID, paste it into the text box in Klipfolio.

profile ID

Let’s set up our metrics and dimensions. In the ‘Metric(s):’ field choose ‘ga:date:. In the ‘Dimension(s):’ field choose ‘ga:sessions’. This will bring back data that allows you to see the number of sessions on your website per day.

For the time period, choose ‘Last 7 Days’ from the drop-down list.

Your page should now look like this:

google analytics query setup

Your query is now set up but you may wonder what the actual query URI looks like. Well, you can take a look at it by changing the mode to ‘Advanced’. 

google analytics query advanced mode

Once you are in Advanced Mode, click ‘Import your query from Simple Mode’ to see what you’ve done so far:

view query uri in advanced mode

Once you have imported your query from Simple Mode, you can see what your query looks like in more detail. Is this format, you can fully edit the query.

One  thing to note is that by default Klipfolio uses dynamic date ranges in queries, and we encourage you to do the same when you are building queries from scratch. Instead of using fixed date ranges that will constantly have to be reconfigured, you can use dynamic date ranges to make sure your data is always fresh. You can see that in the query below, where it says start-date={date.add[-7]. Format[]}&end-date={date.today}, your data always show the last 7 days until today. This will ensure that whatever visualizations you build, they will always show data in real-time.

full query in advanced mode

Switch over to Advanced Mode and make sure you get the exact data you need.

Click ‘Get Data’ and save your new data source.

Congratulations! You now have everything you need to get started building a Google Analytics visualization. Once you have saved your new data source, you will be taken to a new page where you can use the data source you just created to build any type of visualization you want, manipulate the data with formulas and functions, and display it on a dashboard.

 

Lydia Nyilasi I am a technical writer at Klipfolio. I help people integrate their favourite APIs with Klipfolio using how-to articles, videos and within the Klipfolio app itself.

Comments