Official agent skill

Google Analytics Data API Basics

by google in google/skills

Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta).

OfficialApache-2.0Auto-check passedFrontend & Design

Install Google Analytics Data API Basics

skills CLI
$ npx skills add google/skills --skill google-analytics-data-api-basics -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install google/skills google-analytics-data-api-basics --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/google/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/analytics/google-analytics-data-api-basics .claude/skills/google-analytics-data-api-basics && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
google-analytics-data-api-basics
GitHub stars
21k
Token cost
~2.4k tokens
SKILL.md length
819 words
Files
8 (incl. references)
Skills in repo
145
Repo updated
First seen
Licence
Apache-2.0

At a glance

Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta).

  • Works in 2 steps: Enable the API: Use the Cloud CLI… → Verify API Enablement
  • You need to interact with Google Analytics properties
  • SKILL.md covers Enabling the API via Cloud CLI, Authentication, Creating a Data API Report… and Metrics and Dimensions Schema
  • Calls gcloud; reaches googleapis.com

What it does

Google Analytics Data API Basics is an agent skill from google/skills, published by the product's own GitHub organization. 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…

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/dotnet.md`, `references/go.md` and `references/java.md`).

It sits in Frontend & Design, covering Data analysis. It works with Google Analytics, Python, Java and Google Cloud. The repository describes itself as: Agent Skills for Google products and technologies. The licence is Apache-2.0.

When your agent uses it

  • You need to interact with Google Analytics properties
  • Run customized analytics reports
  • Query metrics (like activeUsers
  • ScreenPageViews) and dimensions (like city

Example prompts

  • “Use the google-analytics-data-api-basics skill to manage Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and…”
  • “/google-analytics-data-api-basics”

Requirements

  • Python 3
  • Node.js

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Enable the API: Use the Cloud CLI (gcloud) to enable
  2. Verify API Enablement

What it can do on your machine

Read from SKILL.md and the folder at commit 8a1ac05. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gcloud

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • googleapis.com

    Also links to:

    • developers.google.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Google Analytics Data API Basics loads about 2.4k tokens when it runs, and up to ~5.8k if it reads all its reference files. Until then it costs about 144 tokens; SKILL.md has 819 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~144
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from google/skills at commit 8a1ac05, republished under its Apache-2.0 licence (© google). 819 words, ~2,404 tokens.

Download SKILL.mdSave it as .claude/skills/google-analytics-data-api-basics/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
google-analytics-data-api-basics
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.
metadata.version
1.0.0
metadata.category
GoogleAnalytics

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.

[!IMPORTANT] Mandatory Agent Directive: When the user selects or requires a specific programming language, read the corresponding client library setup reference guide in references/ listed below.

Supported Client Libraries
Python

If you need to install or set up the Google Analytics Data API client library for Python, read the setup guide:

Java

If you need to install or set up the Google Analytics Data API client library for Java, read the setup guide:

PHP

If you need to install or set up the Google Analytics Data API client library for PHP, read the setup guide:

Node.js

If you need to install or set up the Google Analytics Data API client library for Node.js, read the setup guide:

Go

If you need to install or set up the Google Analytics Data API client library for Go, read the setup guide:

.NET

If you need to install or set up the Google Analytics Data API client library for .NET / C#, read the setup guide:

Ruby

If you need to install or set up the Google Analytics Data API client library for Ruby, read the setup guide:

[!NOTE] Additional Resources: For further examples of calling the Data API with Java, PHP, Node.js, .NET, Python and REST, as well as hints on authentication with a service account, refer to the official Data API Quickstart.

Show full SKILL.md (345 more words)Show less
Python Quick Start
  1. Install the Client Library:

    bash
    pip install google-analytics-data

    If pip is not available, prompt the user to install pip before installing the client library.

  2. Run a Report Request: Below is a complete example demonstrating how to query a Google Analytics property for active users and sessions grouped by city and date. Replace YOUR-PROPERTY-ID with your actual Google Analytics property ID (e.g., 1234567).

    python
    from google.analytics.data_v1beta import BetaAnalyticsDataClient
    from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest
    
    def sample_run_report(property_id: str):
        # Initialize the client.
        # Assumes Application Default Credentials (ADC) are configured in your environment.
        client = BetaAnalyticsDataClient()
    
        request = RunReportRequest(
            property=f"properties/{property_id}",
            dimensions=[
                Dimension(name="city"),
                Dimension(name="date")
            ],
            metrics=[
                Metric(name="activeUsers"),
                Metric(name="sessions")
            ],
            date_ranges=[
                DateRange(start_date="2026-05-01", end_date="today")
            ],
        )
    
        response = client.run_report(request)
    
        print(f"Report result for property {property_id}:")
        for row in response.rows:
            print(
                f"City: {row.dimension_values[0].value}, "
                f"Date: {row.dimension_values[1].value}, "
                f"Active Users: {row.metric_values[0].value}, "
                f"Sessions: {row.metric_values[1].value}"
            )
    
    if __name__ == "__main__":
        sample_run_report("YOUR-PROPERTY-ID")

    Why: Using BetaAnalyticsDataClient and RunReportRequest ensures compatibility with the v1beta endpoint and strongly typed request validation.

Metrics and Dimensions Schema

When constructing your RunReportRequest, you must use valid API names for dimensions and metrics. Refer to the official Data API Schema documentation for the complete, authoritative list of available fields.

Commonly Used Dimensions

Dimensions represent categorical attributes of your data.

  • city: The town or city of the user.
  • country: The country of the user.
  • date: The date of the event, formatted as YYYYMMDD.
  • deviceCategory: The category of mobile device (e.g., desktop, mobile, tablet).
  • eventName: The name of the triggered event.
  • pageTitle: The title of the web page.
Commonly Used Metrics

Metrics represent quantitative measurements.

  • activeUsers: The number of active users.
  • eventCount: The total count of events.
  • sessions: The total number of sessions.
  • screenPageViews: The number of app screens or web pages viewed.
  • totalRevenue: The total revenue from purchases, subscriptions, and advertising.
Metrics and Dimensions Compatibility Check

Some dimensions and metrics cannot be queried together in the same report request. If you encounter an INVALID_ARGUMENT error regarding incompatible fields, verify your field combinations For programmatic access to the Data API schema, use getMetadata(). To programmatically check the compatibility of specific dimension and metric combinations before running a report, use the checkCompatibility() method.

python
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import CheckCompatibilityRequest, Compatibility, Dimension, Metric

def sample_check_compatibility(property_id: str):
    client = BetaAnalyticsDataClient()

    # Define the dimensions and metrics you want to query together.
    # For example, checking if 'itemName' (an e-commerce dimension)
    # is compatible with 'activeUsers' and 'totalRevenue'.
    request = CheckCompatibilityRequest(
        property=f"properties/{property_id}",
        dimensions=[
            Dimension(name="itemName"),
            Dimension(name="date")
        ],
        metrics=[
            Metric(name="activeUsers"),
            Metric(name="totalRevenue")
        ],
    )
    response = client.check_compatibility(request)

    print(f"Compatibility check for property {property_id}:")
    for dim in response.dimension_compatibilities:
        is_compatible = dim.compatibility == Compatibility.COMPATIBLE
        print(f"Dimension '{dim.dimension_metadata.api_name}' is compatible: {is_compatible}")

    for metric in response.metric_compatibilities:
        is_compatible = metric.compatibility == Compatibility.COMPATIBLE
        print(f"Metric '{metric.metric_metadata.api_name}' is compatible: {is_compatible}")

if __name__ == "__main__":
    sample_check_compatibility("YOUR-PROPERTY-ID")

© google, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in skills/analytics/google-analytics-data-api-basics of google/skills.

  • SKILL.md
  • references/dotnet.md
  • references/go.md
  • references/java.md
  • references/nodejs.md
  • references/php.md
  • references/python.md
  • references/ruby.md

Open the folder on GitHubat commit 8a1ac05

Compare with similar skills

Google Analytics Data API Basics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Google Analytics Data API Basics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Google Analytics Data API Basics this skillgoogle/skills21k—~2.4kAutomated safety check: PassApache-2.0
Google Analyticsrefly-ai/refly-skills204—~504Automated safety check: PassNone
Bio Causal Genomics Genetic CorrelationGPTomics/bioSkills1.2k2 repos~9.1kAutomated safety check: PassMIT
Vertex AI API DevJetBrains/skills3631 repos~2.4kAutomated safety check: PassNone
Google Search ConsoleVKirill/claude-lane-stack122—~4.9kAutomated safety check: PassMIT
Io ConnectorsKilo-Org/kilo-marketplace189—~1.3kAutomated safety check: PassApache-2.0

Similar skills

  • Google Analytics

    refly-ai/refly-skills

    Integrate with Google Analytics for web metrics. An agent skill from refly-ai/refly-skills.

    204 GitHub stars~504 tokensUpdated 2 mo ago
    Frontend & DesignAuto-check passed
  • Estimates bivariate genetic correlation (rg) between traits from GWAS summary statistics or individual-level genotypes using cross-trait LDSC, HDL, LAVA, rho-HESS, GREML-bivariate, Popcorn, and HDL-L.

    1.2k GitHub starsUsed in 2 repos~9.1k tokens
    Research & ScienceAuto-check passed
  • Vertex AI API Dev

    JetBrains/skills

    Official

    Guides the usage of Gemini API on Google Cloud Vertex AI with the Gen AI SDK.

    363 GitHub starsUsed in 1 repo~2.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Google Search Console

    VKirill/claude-lane-stack

    [RU: Google Search Console API, гугл серч консоль, вебмастер гугл, gsc] GSC (Webmasters) API v1 — OAuth 2.0 + service account, searchanalytics.query (dimensions, filter operators, 25k row cap +…

    122 GitHub stars~4.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Io Connectors

    Kilo-Org/kilo-marketplace

    Guides development and usage of I/O connectors in Apache Beam.

    189 GitHub stars~1.3k tokensUpdated 8 days ago
    Testing & QAAuto-check passed
  • Excel and CSV Data Analysis

    bytedance/deer-flow

    Analyzes uploaded Excel and CSV files with SQL through DuckDB, producing schema inspections, statistical summaries and exports to CSV, JSON or Markdown.

    83k GitHub starsUsed in 4 repos~2.2k tokens
    Data & AnalyticsAuto-check passed

More from google/skills

All 145 skills in this repo
  • Official

    Manages Google Cloud Privileged Access Manager entitlements and grants: create and edit entitlements, request temporary access, and approve or deny pending grants.

    21k GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Official

    Writes Terraform alerting policies for AI agents that emit OpenTelemetry metrics, covering reliability, cost, safety, security and quality signals on Google Cloud.

    21k GitHub stars~4.2k tokensUpdated today
    Auto-check passed
  • Official

    Deploys open models or custom weights from Model Garden to Agent Platform endpoints, checks deployment status and cleans up endpoints, confirming before any change.

    21k GitHub stars~5.1k tokensUpdated today
    Auto-check passed
  • Official

    Searches, manages and scaffolds skills in the Gemini Enterprise Agent Platform Skill Registry using bundled Python scripts and Google Cloud credentials.

    21k GitHub stars~584 tokensUpdated today
    Auto-check passed
  • Designs GCP infrastructure as local Terraform, validates and scans it against best practices, then imports it to Application Design Center for deployment and troubleshooting.

    21k GitHub stars~4.4k tokensUpdated today
    Auto-check passed
  • Official

    Analyzes BigQuery slot use, query costs and execution bottlenecks from INFORMATION_SCHEMA to diagnose slow queries, slot contention and unpartitioned scans.

    21k GitHub stars~2.3k tokensUpdated today
    Auto-check passed

Questions about Google Analytics Data API Basics

What does Google Analytics Data API Basics do?

Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta). Google Analytics Data API Basics is an agent skill from google/skills, published by the product's own GitHub organization. Manages Google Analytics reporting data, enables the Analytics Data API via the Cloud CLI, and creates reports using the Google Analytics Data API (v1beta).

When should I use Google Analytics Data API Basics?

Google Analytics Data API Basics fits situations like: you need to interact with Google Analytics properties; run customized analytics reports; query metrics (like activeUsers; screenPageViews) and dimensions (like city.

How do I install Google Analytics Data API Basics in Claude Code?

Run `npx skills add google/skills --skill google-analytics-data-api-basics -a claude-code`. Or copy the skill folder (skills/analytics/google-analytics-data-api-basics in google/skills) into .claude/skills/google-analytics-data-api-basics in your project. Claude Code loads it when a task matches its description.

How do I install Google Analytics Data API Basics in Codex?

Run `npx skills add google/skills --skill google-analytics-data-api-basics -a codex`. Or copy the skill folder (skills/analytics/google-analytics-data-api-basics in google/skills) into .agents/skills/google-analytics-data-api-basics in your project. Codex loads it when a task matches its description.

Can I use Google Analytics Data API Basics in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add google/skills --skill google-analytics-data-api-basics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/google-analytics-data-api-basics, .gemini/skills/google-analytics-data-api-basics, .github/skills/google-analytics-data-api-basics and .opencode/skills/google-analytics-data-api-basics in your project.

What does Google Analytics Data API Basics need to run?

Going by SKILL.md and its folder, Google Analytics Data API Basics needs the command-line tools its instructions call (gcloud). Our summary lists: Python 3; Node.js.

Does Google Analytics Data API Basics access the network?

SKILL.md names 2 domains. In commands or code: googleapis.com; the agent is likely to contact it when it follows the instructions. As links in the text: developers.google.com. This is read from the text; nothing was executed.

Is Google Analytics Data API Basics safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Google Analytics Data API Basics use?

Google Analytics Data API Basics is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Google Analytics Data API Basics use?

About 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.

What are the alternatives to Google Analytics Data API Basics?

Skills that share tags, products or a category with Google Analytics Data API Basics: Google Analytics (refly-ai/refly-skills, 204 stars), Bio Causal Genomics Genetic Correlation (GPTomics/bioSkills, 1.2k stars), Vertex AI API Dev (JetBrains/skills, 363 stars) and Google Search Console (VKirill/claude-lane-stack, 122 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Google Analytics Data API Basics?

google (a GitHub organization, an official publisher) maintains it in google/skills, which has 20,994 GitHub stars. The repository holds 145 skills in this directory. The repository was last updated on October 6, 2026.

Source: google/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.