The Google Analytics 7: APIs To Explore And Inspire

September 15, 2016 | Samantha Barnes

ga-7-apis-to-inspire

An API (application program interface) is a set of instructions that you give a program to get what you want. It’s like getting a secret phrasebook to communicate with the program- the instructions matter because saying ‘Open the Door’ may not do anything but saying ‘Open Sesame’ will lead you to your next objective. For our purposes, APIs let you combine and customize data by interacting with and bringing together information from a variety of sources.

APIs – You’re the Captain Now

Let’s relate that specifically to Google Analytics. With APIs, we can send out these phrases to other programs and direct the data into our Google Analytics reports (for example, a custom dimension for weather). You can find more information on bringing outside data into the Google Analytics reports in this post by Sayf Sharif.

However, this can work the other way too! Rather than bringing in outside data to Google Analytics, you can also bring Google Analytics data to outside sources. It makes sense if we think of the way a program works.

To put it simply, Google Analytics looks and behaves the way it does because of instructions that happen behind-the-scenes dictating what data to show, what segment to use or what filter to apply. For example, when you see and click the ‘Create New View’ option, it sends instructions to do just that.

If we have an API, we are not just limited to using the Google Analytics interface. Now that we know the secret phrase/instructions for creating a new view, we can do that from anywhere- a web app, a spreadsheet, or even just the terminal on your computer. One of the only limits to what you can accomplish is your level of familiarity with the code you choose. The good news is that for many of the APIs I’m going to list, libraries may be available (some in beta) in JavaScript, Python, Java, Ruby, and PHP.

The Google Analytics 7

It can get a little confusing to start, mainly because there are seven different APIs for Google Analytics depending on what you want to do. Using them require technical skills and development, however, this list is meant to be a reference for both developers and marketers- even if you cannot code, it’s useful to know what is possible and available as you think of reporting and strategy for your organization.

In addition, many have useful tutorials that make it approachable so that even someone with very basic coding knowledge can start using them and exploring. The list below represents the different APIs that Google has created to interact with Google Analytics. Each also has a link to technical reference if you would like to try it out or if you would like to forward to your development team to test. Many of these interact with each other as well (for example, using the Embed API to create a dashboard that retrieves the data with the Reporting API).

Reporting API

The Reporting API the most common Google Analytics API and you may have already used this without knowing it! Some examples that use this API are the Google Sheets Add-On, the Tableau Connector, or an Excel add-on like Shufflepoint. As the name suggests, this API is for reporting purposes and is used to pull the actual Google Analytics data to build reports in other environments. This is the foundational and essential API that most of the others listed below work with. It was recently updated to version 4, so if you are familiar with an earlier version it is worth upgrading to take advantage of calculating metrics in-line, advanced segmentation and date range selection, lifetime value, and cohort data.

Reporting API Version 4 Documentation

Use Cases: Branded reporting, automated spreadsheets, bringing Google Analytics data into a report with other data sources (although keep in mind Data Studio is an option as well!)

Embed API

This API is all about the web and interaction. If you ever wanted to show your data on interactive web dashboards or use visualization libraries, the Embed API makes that possible. It is based on a JavaScript library and has built-in components that make it easy to get started right away. Google Analytics even provides a demo dashboard to test out and see what a basic dashboard will look like with your data. Beyond the basics, you can combine the Embed API with D3 (Data Driven Documents) plugins to create impressive and highly interactive visualizations to be viewed right in the browser. If you haven’t heard of D3, I highly recommend checking out the examples on this site.

Embed API Version 1 Documentation

Use Cases: Animated infographics, integrating data in a web portal, online dashboards, sharing data online for a large team

Metadata API

The Metadata API is similar to the Embed API in that it is considered another “helper” library. It contains access to the latest attributes and calculations of all the dimensions and metrics, so it is akin to using the Dimensions and Metrics Explorer. It will also give information on valid combinations of dimensions and metrics.

Use Cases: Keeping your automated reports up-to-date, discovering valid dimensions and metrics that work together

Metadata API Version 3 Documentation

Multi-Channel Funnel API

Multi-channel funnels are similar to the real-time reports in Google Analytics in that the data used for these is different than all of the other standard reports. This API allows you to query for data around full conversion paths: assisted conversions, multi-session touchpoints, and attribution beyond the “last-click” standard of the Core Reporting API.

Use Cases: Custom attribution modeling, combining outside cost and bid data with Google Analytics conversion paths

Multi-Channel Funnels API Version 3 Documentation

Real Time Reporting API (beta)

All of the other reporting APIs listed here require the data to be processed before you can access the information. The Real Time Reporting API is the exception and gives the opportunity to access many metrics and dimensions that are happening right now on your site. For content sites, vast real-time trending article dashboards are now possible. For eCommerce sites, it is even possible to show alerts like “10 other people are viewing this hotel room” to persuade users to convert sooner.

Use Cases: Real-time visualizations and dashboards, real-time alerts, trending notifications

Real Time Reporting API Version 3 Documentation

Management API

The Management API is all about automation. Beyond reporting, this API will let you perform easy set-up and maintenance of your Google Analytics accounts. Other than performing administrative actions like setting user permissions, linking filters and managing remarketing audiences, you can also use this API to list data on all of your accounts, properties and views.

Use Cases: Programmatic spreadsheet of all views, users or account data, bulk addition of filters or settings

Management API Version 3 Documentation

Provisioning API (Limited)

As one of the newest APIs, there is currently limited access to provisioning actions. The provisioning API allows for creating views, properties, and accounts from scratch with the settings that you configure. Think of enterprise-level account set-up. When a business needs over 200 views and/or properties with specific settings, this is the API you want to look to for automation.

Use Cases: Programmatic and/or bulk creation of views

Provisioning API Version 3 Documentation

More Resources

Even if you aren’t fully ready to dive in and start coding, hopefully, this reference inspires you to think of new ways and ideas to liven your reports or automate your analytics process! If I’ve succeeded in sparking your curiosity, here are some more links to check out:

Google Analytics API Explorer

Code Libraries and Samples of the APIs

Google Analytics Developers G+

Google Analytics API Notify Forum

Google Analytics on Stack Overflow