Google Analytics Admin API Overview

Developer Trusted Testing Preview

Summary: This document provides a high level overview of the Google Analytics Admin API Version 1.0.

Introduction

The Google Analytics Admin API allows for programmatic access to the Google Analytics 4 (GA4) configuration data and is only compatible with GA4 properties. Learn more about GA4 properties.

You can use the Google Analytics Admin API to:

Available methods

Account provisioning

Account management

Account summaries

User permissions management

User permission audit

GA4 properties management

GA4 properties data sharing settings management

Firebase project linking

GA4 data streams management

Global Site Tag generation

Enhanced measurement settings management

Enable the API

Click this button to automatically enable the Google Analytics Admin API:

Enable the Google Analytics Admin API

Quick start guide

Quick start using client libraries

API discovery document

You can query the Google Analytics Admin API discovery document by using the following URL:

https://analyticsadmin.googleapis.com/$discovery/rest?version=v1alpha

Client libraries

See the Quick start guide for examples of using the client libraries.

Java

If you are using Maven, add this to your pom.xml file:

<dependency>
  <groupId>com.google.analytics</groupId>
  <artifactId>google-analytics-admin</artifactId>
  <version>0.1.1</version>
</dependency>

If you are using Gradle, add this to your dependencies
compile 'com.google.analytics:google-analytics-admin:0.1.1'

Python

Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.

With virtualenv, it’s possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

pip install virtualenv
virtualenv 
source <your-env>/bin/activate
<your-env>/bin/pip install google-analytics-admin

Node.js

npm install @google-analytics/admin

Ruby

gem install google-analytics-admin-v1alpha

Go

go get -u cloud.google.com/go/analytics/admin/apiv1alpha

.NET

If you are using Package Manager, execute this command:

Install-Package Google.Analytics.Admin.V1Alpha -Version 1.0.0-alpha01
If you are using .NET CLI, execute this command in your project's folder:
dotnet add package Google.Analytics.Admin.V1Alpha --version 1.0.0-alpha01
You can directly include the library dependency to your project by adding this to your .NET project file:

<PackageReference Include="Google.Analytics.Admin.V1Alpha" Version="1.0.0-alpha01" />

Changelog

  • 2020-08-15 Client libraries have been updated. Please refer to the quickstart samples and reference documentation for the corresponding libraries. Client library artifacts are now published to external repositories.

  • 2020-08-15 Google Analytics Management App + Web API has been renamed to the Google Analytics Admin API. As a result, the API endpoint has changed to analyticsadmin.googleapis.com. Existing code written against the previous version of the API endpoint url and client libraries needs to be updated accordingly.

  • 2020-10-13 App + Web properties have been renamed to Google Analytics 4 (GA4).

  • 2020-10-20 Added support for account summaries.