Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI.

MITAuto-check passedBackend & APIs

Install Ga4 Auth Setup

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-auth-setup -a claude-code

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace ga4-auth-setup --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/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/ga4-auth-setup .claude/skills/ga4-auth-setup && 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
ga4-auth-setup
GitHub stars
2.8k
Token cost
~1.6k tokens
SKILL.md length
618 words
Files
1
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI.

  • Works in 4 steps: Create the SA in GCP → Grant the SA access to your GA4 property → Enable the Data API in the SA's project → …
  • With set up GA4 auth
  • SKILL.md covers Overview, Prerequisites, Instructions and Examples, plus 7 more sections
  • Calls gcloud and python3; reaches googleapis.com; needs GOOGLE_APPLICATION_CREDENTIALS

What it does

Ga4 Auth Setup is an agent skill from jeremylongshore/tons-of-skills-marketplace. Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI. Pick the right path, set the right scopes, grant the right property-level access. Trigger with "set up GA4 auth", "GA4 service account", "GA4 OAuth", "connect to Google Analytics".

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Designed for Claude Code

It sits in Backend & APIs, covering OAuth and OpenID Connect. It works with Google Analytics and Google Cloud. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • With set up GA4 auth
  • GA4 service account
  • Connect to Google Analytics

Example prompts

  • “set up GA4 auth”
  • “GA4 service account”
  • “GA4 OAuth”
  • “/ga4-auth-setup”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Bash(gcloud:*), Bash(curl:*), Bash(jq:*), Bash(python3:*), Bash(ls:*)

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Create the SA in GCP
  2. Grant the SA access to your GA4 property
  3. Enable the Data API in the SA's project
  4. Test the auth round-trip

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(gcloud:*)
    • Bash(curl:*)
    • Bash(jq:*)
    • Bash(python3:*)
    • Bash(ls:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gcloud
    • python3

    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:

    • analytics.google.com

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

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • GOOGLE_APPLICATION_CREDENTIALS

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

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Ga4 Auth Setup loads about 1.6k tokens when it runs. Until then it costs about 80 tokens; SKILL.md has 618 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~80
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

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 jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 618 words, ~1,628 tokens.

Download SKILL.mdSave it as .claude/skills/ga4-auth-setup/SKILL.md (or your agent's skills folder).
name
ga4-auth-setup
description
Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI. Pick the right path, set the right scopes, grant the right property-level access. Trigger with "set up GA4 auth", "GA4 service account", "GA4 OAuth", "connect to Google Analytics".
allowed-tools
Bash(gcloud:*), Bash(curl:*), Bash(jq:*), Bash(python3:*), Bash(ls:*)
compatibility
Designed for Claude Code
version
1.3.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, analytics, google-analytics, ga4, auth

GA4 Auth Setup

Overview

GA4 has two production-grade auth paths. Pick before you start; mixing them mid-flight is the most common failure mode.

PathWhenCredential file
Service accountAutomation, CI, server-side scripts. Token is long-lived, scoped, revocable.~/.config/gcloud/sa-ga4.json (or any path you choose)
OAuth user credsInteractive use, multiple GA4 properties, ad-hoc analyst work. Token refreshes from a ~/.config/gcloud/application_default_credentials.json file.ADC

Recommendation: service account for any pipeline / report-runner / agent use. OAuth for a human poking around. Don't share OAuth user creds across machines — that's an audit-trail mess.

Prerequisites

  • A Google Cloud project where you can create a service account and enable APIs, or a Google account with access to the target GA4 property.
  • The GA4 property ID (digits only, not the G-... measurement ID).
  • gcloud authenticated to the GCP project; the Python verification also needs the Google Analytics Data API client library installed.

Instructions

Examples

1. Create the SA in GCP
bash
PROJECT=your-gcp-project          # the project that will own the SA
SA_NAME=ga4-reader
SA_EMAIL="${SA_NAME}@${PROJECT}.iam.gserviceaccount.com"

gcloud iam service-accounts create "$SA_NAME" \
  --display-name="GA4 read-only API access" \
  --project="$PROJECT"

# Generate a key (file lands locally)
gcloud iam service-accounts keys create ~/.config/gcloud/sa-ga4.json \
  --iam-account="$SA_EMAIL"
2. Grant the SA access to your GA4 property

This is the step everyone forgets. GA4 has property-level access control that lives in the Google Analytics web UI, NOT in GCP IAM. The service account email needs to be added there.

  1. Open https://analytics.google.com/
  2. Admin (bottom-left gear) → Property column → Property Access Management
  3. Add user: paste $SA_EMAIL (e.g. ga4-reader@your-project.iam.gserviceaccount.com)
  4. Role: Viewer (read-only — anything more is over-privilege)
  5. Save
3. Enable the Data API in the SA's project
bash
gcloud services enable analyticsdata.googleapis.com --project="$PROJECT"
4. Test the auth round-trip
bash
GOOGLE_APPLICATION_CREDENTIALS=~/.config/gcloud/sa-ga4.json \
PROPERTY_ID=123456789 \
python3 -c "
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import RunReportRequest, DateRange, Metric, Dimension
import os
client = BetaAnalyticsDataClient()
req = RunReportRequest(
    property=f'properties/{os.environ[\"PROPERTY_ID\"]}',
    date_ranges=[DateRange(start_date='7daysAgo', end_date='today')],
    metrics=[Metric(name='activeUsers')],
    dimensions=[Dimension(name='date')],
)
resp = client.run_report(req)
for row in resp.rows:
    print(row.dimension_values[0].value, row.metric_values[0].value)
"

If you get rows back, auth works. If you get PermissionDenied: 403, the SA isn't added to the property (step 2). If you get Disabled: 403, the API isn't enabled (step 3).

Path B — OAuth user credentials (interactive)

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

This opens a browser, you sign in with the Google account that has access to the GA4 property, and a refresh token lands at ~/.config/gcloud/application_default_credentials.json. The Data API client picks it up automatically when GOOGLE_APPLICATION_CREDENTIALS is not set.

Same test as Path A step 4 — just omit the GOOGLE_APPLICATION_CREDENTIALS= prefix.

Finding your PROPERTY_ID

GA4 property IDs are 9-digit numbers (not the G-XXXXX measurement ID, which is for the front-end tracker).

  1. Open https://analytics.google.com/
  2. Admin → Property column → Property Details
  3. Top of the page: Property ID — copy the digits, e.g. 123456789
Show full SKILL.md (248 more words)Show less

Secret hygiene

  • Never commit the SA JSON key. Add to .gitignore:

    *-sa-*.json
    sa-ga4.json
  • Use SOPS+age for the SA key in any repo it lives in. Per the IS standard: cd <repo> && sops-init, then mv ~/.config/gcloud/sa-ga4.json .sops/ga4-sa.json.sops and decrypt in-process when needed.

  • Rotate the SA key annually at minimum: gcloud iam service-accounts keys list --iam-account=$SA_EMAIL shows the active keys; create a new one + delete the old one.

  • Grant Viewer-only at the GA4 property level. Editor or Administrator gives the SA the power to delete the property — you don't want a CI pipeline with that blast radius.

Output

You will have either a service-account key usable by automated clients or local OAuth application-default credentials for interactive use. The verification request prints date and active-user rows when the selected credential can read the specified property.

Error Handling

ErrorLikely causeFix
403 PermissionDenied: User does not have sufficient permissions for this property.SA email not added to GA4 propertyPath A, step 2
403 SERVICE_DISABLEDData API not enabled in SA's GCP projectPath A, step 3
401 UNAUTHENTICATEDGOOGLE_APPLICATION_CREDENTIALS points to a missing/unreadable filels -la $GOOGLE_APPLICATION_CREDENTIALS
Invalid property ID: G-XXXXUsing measurement ID instead of property IDSee "Finding your PROPERTY_ID" above
Quota exceededDefault Data API quota is 200K tokens/day per propertyCheck Quotas in Cloud Console; raise quota or batch queries with broader date ranges

Resources

  • ga4-data-api-query — once auth works, build the actual runReport call
  • ga4-bigquery-export — for unsampled event-level data via BigQuery instead of the Data API

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

Files

Just SKILL.md in skills/.curated/ga4-auth-setup of jeremylongshore/tons-of-skills-marketplace.

Open the folder on GitHubat commit cfae287

Compare with similar skills

Ga4 Auth Setup 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.

Ga4 Auth Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ga4 Auth Setup this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.6kAutomated safety check: PassMIT
Google Cloud AuthVKirill/claude-lane-stack122—~3.1kAutomated safety check: NotesMIT
Google Search ConsoleVKirill/claude-lane-stack122—~4.9kAutomated safety check: PassMIT
YandexVKirill/claude-lane-stack122—~1.3kAutomated safety check: PassMIT
Setupdaiki-beppu/youtube-automation169—~1.3kAutomated safety check: PassCustom licence
Atmos Authcloudposse/atmos1.4k—~4.2kAutomated safety check: PassApache-2.0

Similar skills

  • Google Cloud Auth

    VKirill/claude-lane-stack

    [RU: oauth google, авторизация гугл, service account, sa key, refresh token, invalidgrant, adc, google cloud auth] Google auth for all Google APIs — OAuth 2.0, Service Account JWT, ADC.

    122 GitHub stars~3.1k tokensUpdated 2 days ago
    Backend & APIsAuto-check: notes
  • 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 2 days ago
    Backend & APIsAuto-check passed
  • Yandex

    VKirill/claude-lane-stack

    [RU: экосистема Яндекса] Cloud, Direct API, креативы Direct, Метрика, Вебмастер.

    122 GitHub stars~1.3k tokensUpdated 2 days ago
    Marketing & SEOAuto-check passed
  • Setup

    daiki-beppu/youtube-automation

    A skill your agent uses when ツール導入と GCP / OAuth の設定、新規 YouTube チャンネル開設、既存チャンネル取り込み、config 再生成、または YouTube 側設定同期を行うとき。「セットアップして」「環境構築」「新チャンネル」「既存チャンネル」「チャンネル取り込み」「config…

    169 GitHub stars~1.3k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Atmos Auth

    cloudposse/atmos

    Authentication and identity management: providers (SSO/SAML/OIDC/GCP/Atmos Pro), identities, keyring, identity chaining, login/exec/shell/console, and github/sts for private GitHub access

    1.4k GitHub stars~4.2k tokensUpdated today
    Backend & APIsAuto-check passed
  • Implementing API Threat Protection With Apigee

    mukul975/Anthropic-Cybersecurity-Skills

    Implements API threat protection using Google Apigee reverse-proxy policies, including JSON/XML threat protection, OAuth 2.0 enforcement, SpikeArrest rate limiting, regex-based threat detection, and…

    34k GitHub stars~2.8k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Categories

Questions about Ga4 Auth Setup

What does Ga4 Auth Setup do?

Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI. Ga4 Auth Setup is an agent skill from jeremylongshore/tons-of-skills-marketplace. Configure auth for the GA4 Data API — OAuth user credentials for interactive use, or a service account for automation / CI.

When should I use Ga4 Auth Setup?

Ga4 Auth Setup fits situations like: with set up GA4 auth; GA4 service account; connect to Google Analytics.

How do I install Ga4 Auth Setup in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-auth-setup -a claude-code`. Or copy the skill folder (skills/.curated/ga4-auth-setup in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/ga4-auth-setup in your project. Claude Code loads it when a task matches its description.

How do I install Ga4 Auth Setup in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-auth-setup -a codex`. Or copy the skill folder (skills/.curated/ga4-auth-setup in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/ga4-auth-setup in your project. Codex loads it when a task matches its description.

Can I use Ga4 Auth Setup 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 jeremylongshore/tons-of-skills-marketplace --skill ga4-auth-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ga4-auth-setup, .gemini/skills/ga4-auth-setup, .github/skills/ga4-auth-setup and .opencode/skills/ga4-auth-setup in your project.

What does Ga4 Auth Setup need to run?

Going by SKILL.md and its folder, Ga4 Auth Setup needs the command-line tools its instructions call (gcloud and python3) and credentials named GOOGLE_APPLICATION_CREDENTIALS. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Bash(gcloud:*), Bash(curl:*), Bash(jq:*), Bash(python3:*), Bash(ls:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Ga4 Auth Setup 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: analytics.google.com. This is read from the text; nothing was executed.

Is Ga4 Auth Setup 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 Ga4 Auth Setup use?

Ga4 Auth Setup is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ga4 Auth Setup use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ga4 Auth Setup?

Skills that share tags, products or a category with Ga4 Auth Setup: Google Cloud Auth (VKirill/claude-lane-stack, 122 stars), Google Search Console (VKirill/claude-lane-stack, 122 stars), Yandex (VKirill/claude-lane-stack, 122 stars) and Setup (daiki-beppu/youtube-automation, 169 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ga4 Auth Setup?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

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