Management API - Account Developer Guide

This document explains how to use the Management API to access Account data.


A Google Analytics Account is a top level entity in the Management API. It has no parent, and it has a collection of Web Properties resources as children.

  • Read the entity overview in the Management API overview guide to understand how accounts relate to other Management API entities.
  • Read the Accounts & Views (Profiles) conceptual guide for general information about accounts.

Before You Begin

This guide demonstrates how to access the Google Analytics API using the following programming languages:
  • Java
  • Python
  • PHP

  • Read the client libraries page for a complete list of programming language specific client libraries that work with the Management API.
  • Read the Reference Guide to access the API without a client library

Each client library provides a single Analytics service object to access all Management API data. To create the service object you generally have to go through the following steps:

  1. Register your application in the Google Developers Console.
  2. Authorize access to Google Analytics data.
  3. Create an Analytics service object.

If you haven't completed these steps, please stop and read the Hello Google Analytics API Tutorial. This tutorial will walk you through the initial steps of building a Google Analytics API application. Once complete, you will be able to use this guide to perform real-world tasks.

The following code snippet continues from step 3: Create an Analytics service object and contains a variable to store an authorized service object.


Analytics analytics = // Read Hello Analytics Tutorial for details.


analytics = # Read Hello Analytics Tutorial for details.


$client = // Read Hello Analytics Tutorial for details.

// Return results as objects.

$analytics = new apiAnalyticsService($client);

The PHP library will return all the API results as an associative array. To return real objects instead, you can call the client useObject method as demonstrated in the example above.

Once you create an Analytics service object, you are ready to make requests to the Management API.

Note: The same Analytics service object can also be used to access the Core Reporting API.

Code Examples

The Management API allows you to list all the accounts for an authorized user. To list accounts, you first need to create an Analytics service object, as described in the Before Your Begin section.

For code examples that show you how to work with the Account resource, read the list method reference

Sample Application

See the Management API Reference Sample for a working example of how to traverse and access all the data in the Management API.


Google Analytics API Java client library Sample


Google Analytics API Python client library Sample


Google Analytics API PHP client library Sample