Overview

This document describes the Google Analytics Reporting API v4. For a detailed reference of the API, see the Reference Guide.

Introduction

The Google Analytics Reporting API v4 is the most advanced programmatic method to access report data in Google Analytics. With the Google Analytics Reporting API, you can:

  • Build custom dashboards to display Google Analytics data.
  • Automate complex reporting tasks to save time.
  • Integrate your Google Analytics data with other business applications.

Features

Google Analytics is built upon a powerful data reporting infrastructure. The Google Analytics Reporting API v4 gives you access to the power of the Google Analytics platform. The API provides these key features:

  • Metric expressions

    The API allows you to request not only built-in metrics but also combination of metrics expressed in mathematical operations. For example, you can use the expression ga:goal1completions/ga:sessions to request the goal completions per number of sessions.

  • Multiple date ranges

    The API allows you in a single request to get data in two date ranges.

  • Cohorts and Lifetime value

    The API has a rich vocabulary to request Cohort and Lifetime value reports.

  • Multiple segments

    The API enables you to get multiple segments in a single request.

Choosing which version of the Analytics Reporting API to use

Building a new application:

Use the Analytics Reporting API v4 because:

  • API v4 has a much richer feature set, such as lifetime value, cohorts, and advanced segmentation reports.
  • All new feature development will use API v4.

Migrating an existing application to use API v4:

  • If you are using the Core Reporting API v3 in your application, migrate it to API v4 to take advantage of v4's new features.
  • Migrating from API v4 to API v3 is easy because v4 supports v3's syntax for segments and filters.

Sticking with v3 or earlier versions of the API:

  • The Analytics Reporting API v4 is separate from other v3 APIs (e.g., Management API, Metadata API, etc.) and requires a separate client library. This may be a consideration for staying with API v3 if you are building an application (i.e., an mobile application) with space constraints.
  • We will continue to support earlier versions of the API, but new feature development will target API v4.
  • Any changes to the support of API v3 are announced in the changelogs.

Next steps

Quick start guides

The following table provides a set of quick start guides to help you get up and running quickly. You will need to pick a language and an application type:

Service application Installed application Web application
Java Java
Python Python
PHP PHP
JavaScript

To get a better understanding of how to use the Analytics Reporting API v4, read Creating a Report.