The Google Analytics Management API enables programmatic access to accounts, properties and views. This document describes how to use various API resources to configure your Google Analytics Account setup.
There are two common use cases that the Management API addresses when it comes to configuring your Google Analytics account setup. The first being the need to quickly get an account summary of the complete hierarchal tree of accounts, properties and views. The second is to make specific configuration changes.
The Account Summaries endpoint provides an easy way to list lightweight information about Google Analytics accounts, properties and views for an authorized user with a single and fast request.
Account summaries can be used to build an index of the account hierarchy. It's common for applications that integrate with Google Analytics to provide an interface for users to select an account, property and view. With a single request to the API you can retrieve all of the relevant information to build such a selector. For an example see the Query Explorer and code samples on Github.
As the top level entity accounts are important because every lower level API request requires an account ID. The management API only allows for the list operation on accounts. Of note in the API response is the
childlink property which gives the API request for all the child web properties.
Also called Web Properties, the second level entity is important because all data collection happens at this level. For example when you add tracking code to a web site or mobile application, you must include an ID that looks like
UA-XXXXX-Y. This ID is called a property ID or tracking ID and distinguishes in which Google Analytics account data is stored. You can use the API to create or update properties, see the property resource for details and code examples.
As the third level in the Account hierarchy, views (profiles) are important because this is the level where reporting takes place. The Core Reporting API, uses the view (profile) ID as a key parameter to specify from which view to retrieve data. In addition to being the reporting level many other resources are either linked or are children of this resource, for example goals, experiments, unsampled reports, and filter links. You can use the API to create or update views, see the view (profile) resource for details and code examples.
After reading this guide you should have a good understanding of how to use the Management API to traverse and manipulate the various account configuration entities. The next guide will cover how to use the API to perform user management.