# Google Analytics Data API Basics

Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud...

- Repository: https://github.com/google/skills (21764 stars)
- Category: Design
- License: Apache-2.0
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add google/skills --skill google-analytics-data-api-basics -g -a claude-code -y`
Codex: `npx skills add google/skills --skill google-analytics-data-api-basics -g -a codex -y`
Cursor: `npx skills add google/skills --skill google-analytics-data-api-basics -g -a cursor -y`
Gemini CLI: `npx skills add google/skills --skill google-analytics-data-api-basics -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add google/skills`

## Description

Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta). Use when you need to interact with Google Analytics properties, run customized analytics reports, query metrics (like activeUsers, screenPageViews) and dimensions (like city, date), check metrics and dimensions compatibility, or verify API enablement. Don't use for Google Analytics Admin API operations (e.g., creating properties, managing users) or for front-end tracking installation.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Getting Started with Google Analytics Data API

The Google Analytics Data API v1beta provides programmatic access to Google
Analytics report data. It allows you to build customized dashboards,
automate reporting workflows, and integrate Google Analytics data into your enterprise
applications.

## Enabling the API via Cloud CLI

Before making API calls, ensure the Google Analytics Data API is enabled in your
Google Cloud project.

If `gcloud` is not found, prompt the user to install the Google Cloud CLI before
running these commands.

1.  **Enable the API:** Use the Cloud CLI (`gcloud`) to enable
    `analyticsdata.googleapis.com`.

    ```bash
    gcloud services enable analyticsdata.googleapis.com --quiet
    ```

    *Why: Enabling the API ensures your Cloud project has the necessary quota
    and permissions allocated for running Google Analytics reports.*

2.  **Verify API Enablement:**

    ```bash
    gcloud services list --enabled --filter="analyticsdata.googleapis.com"
    ```

## Authentication

To authenticate your API requests, you must generate Application Default
Credentials (ADC) and give your account the necessary scopes. Run the following
command in your terminal:

```bash
gcloud auth application-default login --scopes="https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/analytics.readonly"
```

*Why: This configures ADC in your local environment with the required Cloud
Platform and Google Analytics read-only scopes, allowing the client library to
automatically authenticate your requests.*

## Creating a Data API Report (v1beta)

To create a report, use the official Google Analytics Data client library.
Always prefer the `v1beta` version of the API for stability and access to
current Google Analytics reporting capabilities.

The rest: https://github.com/google/skills/blob/HEAD/skills/analytics/google-analytics-data-api-basics/SKILL.md
