Wire GA4 → BigQuery for unsampled, queryable event-level data.

MITAuto-check passedDatabases

Install Ga4 Bigquery Export

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

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace ga4-bigquery-export --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/plugins/saas-packs/ga4-pack/skills/ga4-bigquery-export .claude/skills/ga4-bigquery-export && 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-bigquery-export
GitHub stars
2.8k
Token cost
~2.8k tokens
SKILL.md length
1,008 words
Files
1
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Wire GA4 → BigQuery for unsampled, queryable event-level data.

  • Works in 3 steps: Link your GA4 property to a GCP project → Verify the export is working → Authorize a service account for querying
  • With GA4 BigQuery
  • SKILL.md covers Overview, Prerequisites, Instructions and Setup — one time, plus 10 more sections
  • Calls bq and gcloud

What it does

Ga4 Bigquery Export is an agent skill from jeremylongshore/tons-of-skills-marketplace. Wire GA4 → BigQuery for unsampled, queryable event-level data. Covers the one-time export setup, the eventsYYYYMMDD table schema, partitioning + clustering, and the SQL patterns for the reports the Data API can't do well (true cohort retention, custom-event attribution, large date ranges). Trigger with "GA4 BigQuery", "GA4 to BQ", "event-level GA4 data", "unsampled GA4", "GA4 export setup", "GA4 SQL".

Its SKILL.md is about 2.8k 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 Databases, covering Data warehousing and SQL. It works with Google Analytics, Google BigQuery, SQL 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 GA4 BigQuery
  • Event-level GA4 data
  • GA4 export setup

Example prompts

  • “GA4 BigQuery”
  • “GA4 to BQ”
  • “event-level GA4 data”
  • “/ga4-bigquery-export”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Bash(bq:*), Bash(gcloud:*)

Workflow steps

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

  1. Link your GA4 property to a GCP project
  2. Verify the export is working
  3. Authorize a service account for querying

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(bq:*)
    • Bash(gcloud:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bq
    • gcloud

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

  • Network

    Links to these hosts (documentation or services it may open):

    • analytics.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.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Ga4 Bigquery Export loads about 2.8k tokens when it runs. Until then it costs about 106 tokens; SKILL.md has 1,008 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~106
When it runs · the whole SKILL.md, loaded when a task matches
~2.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 jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 1,008 words, ~2,793 tokens.

Download SKILL.mdSave it as .claude/skills/ga4-bigquery-export/SKILL.md (or your agent's skills folder).
name
ga4-bigquery-export
description
Wire GA4 → BigQuery for unsampled, queryable event-level data. Covers the one-time export setup, the events_YYYYMMDD table schema, partitioning + clustering, and the SQL patterns for the reports the Data API can't do well (true cohort retention, custom-event attribution, large date ranges). Trigger with "GA4 BigQuery", "GA4 to BQ", "event-level GA4 data", "unsampled GA4", "GA4 export setup", "GA4 SQL".
allowed-tools
Bash(bq:*), Bash(gcloud:*)
compatibility
Designed for Claude Code
version
1.3.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, analytics, google-analytics, ga4, bigquery

GA4 → BigQuery Export

Overview

The Data API is good but bounded — sampled past a threshold, capped at ~150 dimensions, no cohort joins. BigQuery export gives you the raw event stream as SQL-queryable tables, free at the standard GA4 tier (up to 1M events/day), with no sampling and full event payloads.

This skill: one-time setup, then the SQL recipes for what the Data API can't do well.

Prerequisites

  • A GA4 property for which you can create a BigQuery link.
  • A Google Cloud project with BigQuery enabled and permission to grant project IAM roles.
  • The bq and gcloud CLIs authenticated to that project; use the service account created by ga4-auth-setup for unattended queries.

Instructions

Setup — one time

In https://analytics.google.com/:

  1. Admin → Property column → BigQuery Links
  2. Create a link → pick your GCP project
  3. Data location: pick the BQ region for the export tables (US multi-region is fine for most cases; EU if you need data residency)
  4. Export type:
    • Daily — single events_YYYYMMDD table per day, written ~24h after midnight. Fine for most reporting.
    • Streaming — events_intraday_YYYYMMDD table written ~near-real-time. Costs more, useful for hot ops dashboards.
    • Most setups: enable both. Streaming for "today", daily for everything else.
  5. Include advertising identifiers — uncheck unless you specifically need device-graph data (most don't)
  6. Save

The first daily table lands within 24h. The first streaming table is near-immediate. After that you have a new events_YYYYMMDD every day forever, no maintenance needed.

2. Verify the export is working
bash
PROJECT=your-gcp-project
DATASET=analytics_123456789       # auto-named after the property ID

bq ls "$PROJECT:$DATASET" 2>&1 | head -10
# Expect: events_YYYYMMDD tables + events_intraday_YYYYMMDD if streaming enabled

If you see no dataset, the link is configured but the first export hasn't fired yet — wait 24h.

3. Authorize a service account for querying

The SA from ga4-auth-setup only has Data API access. For BQ queries, grant the same SA:

bash
SA_EMAIL=ga4-reader@your-project.iam.gserviceaccount.com
gcloud projects add-iam-policy-binding "$PROJECT" \
  --member="serviceAccount:$SA_EMAIL" \
  --role="roles/bigquery.dataViewer"
gcloud projects add-iam-policy-binding "$PROJECT" \
  --member="serviceAccount:$SA_EMAIL" \
  --role="roles/bigquery.jobUser"

dataViewer reads tables; jobUser lets the SA run queries (queries are jobs in BQ's model).

The events table schema (the important columns)

Every row in events_YYYYMMDD is one event. The schema is denormalized — user + session + event + page + device all flat in each row.

ColumnTypeNotes
event_dateSTRING'YYYYMMDD'
event_timestampINT64Microseconds since epoch
event_nameSTRINGpage_view, session_start, purchase, custom event names
event_paramsARRAY<STRUCT<key, value>>All event parameters; value is itself a union STRUCT (string_value, int_value, float_value, double_value)
user_pseudo_idSTRINGGA4's cookie-based user ID (anonymous unless user_id is set)
user_idSTRINGIf you set user_id via gtag('set', {user_id: '...'})
user_propertiesARRAY<STRUCT<key, value>>Same shape as event_params
device.*STRUCTcategory / os / browser / model
geo.*STRUCTcountry / region / city
traffic_source.*STRUCTsource / medium / campaign of FIRST session (not current)
session_traffic_source_last_click.*STRUCTsource / medium of CURRENT session — what you usually want
ga_session_id (param)INT64Pulled via (SELECT value.int_value FROM UNNEST(event_params) WHERE key='ga_session_id')
ga_session_number (param)INT64Same idiom — 1 = first session, 2 = second, etc.

The event_params and user_properties arrays are the gnarly bit. Pulling a parameter requires UNNEST + filter. The idiom:

sql
-- Pull the page_location for every page_view
SELECT
  TIMESTAMP_MICROS(event_timestamp) AS ts,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page,
  user_pseudo_id
FROM `your-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260513' AND '20260520'
  AND event_name = 'page_view'
LIMIT 100;

_TABLE_SUFFIX BETWEEN '...' AND '...' is the canonical way to scan a date range across the wildcard table. Always set it — without a suffix filter, you query the entire history and pay for it.

Examples

Recipe 1 — True cohort retention

The thing the Data API can't do cleanly:

sql
WITH first_seen AS (
  SELECT
    user_pseudo_id,
    DATE(MIN(TIMESTAMP_MICROS(event_timestamp))) AS first_date
  FROM `your-project.analytics_123456789.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20260401' AND '20260520'
  GROUP BY user_pseudo_id
),
activity AS (
  SELECT
    user_pseudo_id,
    DATE(TIMESTAMP_MICROS(event_timestamp)) AS active_date
  FROM `your-project.analytics_123456789.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20260401' AND '20260520'
  GROUP BY user_pseudo_id, active_date
)
SELECT
  DATE_TRUNC(f.first_date, WEEK) AS cohort_week,
  DATE_DIFF(a.active_date, f.first_date, WEEK) AS weeks_since,
  COUNT(DISTINCT a.user_pseudo_id) AS active_users
FROM first_seen f
JOIN activity a USING (user_pseudo_id)
GROUP BY cohort_week, weeks_since
ORDER BY cohort_week, weeks_since;

Output: rows of (cohort_week, weeks_since, active_users). Pivot in your tool of choice for the classic triangle chart.

Recipe 2 — Sessions table (denormalized from events)

GA4's BQ export is event-rows, not session-rows. To reason about sessions, build the session table yourself:

sql
WITH sessions AS (
  SELECT
    user_pseudo_id,
    (SELECT value.int_value FROM UNNEST(event_params) WHERE key = 'ga_session_id') AS session_id,
    MIN(TIMESTAMP_MICROS(event_timestamp)) AS session_start,
    MAX(TIMESTAMP_MICROS(event_timestamp)) AS session_end,
    COUNT(*) AS event_count,
    COUNTIF(event_name = 'page_view') AS pageviews,
    ANY_VALUE(device.category) AS device,
    ANY_VALUE(geo.country) AS country,
    ANY_VALUE(session_traffic_source_last_click.manual_campaign.source) AS source,
    ANY_VALUE(session_traffic_source_last_click.manual_campaign.medium) AS medium,
  FROM `your-project.analytics_123456789.events_*`
  WHERE _TABLE_SUFFIX BETWEEN '20260513' AND '20260520'
  GROUP BY user_pseudo_id, session_id
  HAVING session_id IS NOT NULL
)
SELECT * FROM sessions
ORDER BY session_start DESC
LIMIT 100;

You'd usually CREATE TABLE or CREATE MATERIALIZED VIEW over this — querying the events table directly every time is slow + expensive.

Recipe 3 — Top pages by source

sql
SELECT
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location') AS page,
  session_traffic_source_last_click.manual_campaign.source AS source,
  COUNT(*) AS pageviews,
  COUNT(DISTINCT user_pseudo_id) AS users
FROM `your-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20260513' AND '20260520'
  AND event_name = 'page_view'
GROUP BY page, source
HAVING pageviews > 10        -- filter the long tail
ORDER BY pageviews DESC
LIMIT 50;
Show full SKILL.md (428 more words)Show less

Cost considerations

BigQuery costs $5/TB scanned (first 1 TB/month free). What that translates to in practice:

Scenario~TB / query
Small site, 1k events/day, 30-day window< 1 GB
Medium site, 100k events/day, 30-day window~10 GB
Large site, 1M events/day, 30-day window~100 GB
Same scenarios but querying the full 14-month history12-15x the above

Stay under the free tier with normal usage. Cost-saving patterns:

  1. Always set _TABLE_SUFFIX BETWEEN — don't scan all history if you only need 7 days
  2. Materialize hot queries — CREATE TABLE / CREATE MATERIALIZED VIEW for sessions, daily aggregates, etc.
  3. SELECT only the columns you need — BQ is columnar; selecting event_params array always reads the whole array even if you only want one parameter
  4. Use --dry-run before any new query to see TB scanned: bq query --dry_run --use_legacy_sql=false "SELECT ..."

Streaming vs daily — which to query

Table prefixWhen
events_YYYYMMDDStable historical data. Use for reports, analysis.
events_intraday_YYYYMMDD"Today" data, near-realtime. Schema is identical, but rows may not be deduped yet.
events_* (wildcard)When the date range crosses both. BQ will scan both transparently.

Today's data lives in events_intraday_TODAY; tomorrow it gets rolled into events_TODAY and the intraday table for today is dropped. So if you have a query that needs both stable history + today, use events_* and filter on _TABLE_SUFFIX.

Output

After the first export window, the linked dataset contains daily events_YYYYMMDD tables (and optional intraday tables). The example queries return cohort, session, or page-level rows suitable for further analysis; every wildcard query includes a bounded _TABLE_SUFFIX range.

Error Handling

IssueWhy
Numbers don't match the GA4 UI exactlyUI uses different identity-stitching for cross-device users; raw events are pre-stitching. Off by a few % is expected.
event_params UNNEST returns NULLThe key doesn't exist on that event. Always wrap in (SELECT ... LIMIT 1) so missing-key events return NULL instead of erroring.
Query scans way more than expectedMissing _TABLE_SUFFIX filter, OR using events_* without a _TABLE_SUFFIX BETWEEN clause
events_intraday_* has 2x the rows you'd expectIntraday tables aren't deduped; the same event may appear twice if it was buffered + retried. The daily rollup dedupes.
No user_id even though I set it on the front-enduser_id is the explicit identifier; user_pseudo_id is the auto-generated cookie ID. If user_id is consistently NULL, the gtag('set', {user_id: ...}) call is firing AFTER the event you're checking, or it's set on a property that the export doesn't pull.

Resources

  • ga4-auth-setup — for the service account that queries BQ
  • ga4-data-api-query — when you DON'T need event-level granularity (Data API is faster + cheaper for aggregates)
  • ga4-common-reports — the Data API recipes that BQ supersedes

© 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 plugins/saas-packs/ga4-pack/skills/ga4-bigquery-export of jeremylongshore/tons-of-skills-marketplace.

Open the folder on GitHubat commit cfae287

Compare with similar skills

Ga4 Bigquery Export 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 Bigquery Export compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ga4 Bigquery Export this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.8kAutomated safety check: PassMIT
Imaging Data CommonsK-Dense-AI/scientific-agent-skills48k1 repos~7.8kAutomated safety check: PassMIT
Bigquery Observabilitygoogle/skills21k—~3.5kAutomated safety check: PassApache-2.0
Bigquery Optimizationgoogle/skills21k—~2.3kAutomated safety check: PassApache-2.0
dbt Snowflake to BigQuery Translatorgoogle/skills21k—~2.7kAutomated safety check: PassApache-2.0
Cxas Configurable DashboardsGoogleCloudPlatform/cxas-scrapi107—~1.8kAutomated safety check: PassApache-2.0

Similar skills

  • Imaging Data Commons

    K-Dense-AI/scientific-agent-skills

    Queries and downloads public cancer imaging data from NCI Imaging Data Commons.

    48k GitHub starsUsed in 1 repo~7.8k tokens
    DatabasesAuto-check passed
  • Official

    Provides data-retrieval best practices, tool selection guidance, and performant SQL query syntax for BigQuery telemetry across INFORMATIONSCHEMA, Cloud Monitoring, and the REST API.

    21k GitHub stars~3.5k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Official

    Provides workflows to optimize BigQuery environments (capacity planning, editions), storage assets (partitioning, clustering, storage lifecycles, billing models), and SQL queries.

    21k GitHub stars~2.3k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Translates Snowflake dbt SQL models into standardized BigQuery SQL, keeping Jinja constructs and tracking progress in a migration tasks file.

    21k GitHub stars~2.7k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Cxas Configurable Dashboards

    GoogleCloudPlatform/cxas-scrapi

    Author, validate, and manage Contact Center AI (CCAI) Insights Configurable Dashboards.

    107 GitHub stars~1.8k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Semantic Analyst

    sidequery/sidemantic

    Answer analytical, KPI, metric, trend, cohort, and business-performance questions through a Sidemantic semantic layer.

    129 GitHub stars~982 tokensUpdated 3 days ago
    DatabasesAuto-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 Bigquery Export

What does Ga4 Bigquery Export do?

Wire GA4 → BigQuery for unsampled, queryable event-level data. Ga4 Bigquery Export is an agent skill from jeremylongshore/tons-of-skills-marketplace. Wire GA4 → BigQuery for unsampled, queryable event-level data.

When should I use Ga4 Bigquery Export?

Ga4 Bigquery Export fits situations like: with GA4 BigQuery; event-level GA4 data; GA4 export setup.

How do I install Ga4 Bigquery Export in Claude Code?

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

How do I install Ga4 Bigquery Export in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-bigquery-export -a codex`. Or copy the skill folder (plugins/saas-packs/ga4-pack/skills/ga4-bigquery-export in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/ga4-bigquery-export in your project. Codex loads it when a task matches its description.

Can I use Ga4 Bigquery Export 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-bigquery-export -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-bigquery-export, .gemini/skills/ga4-bigquery-export, .github/skills/ga4-bigquery-export and .opencode/skills/ga4-bigquery-export in your project.

What does Ga4 Bigquery Export need to run?

Going by SKILL.md and its folder, Ga4 Bigquery Export needs the command-line tools its instructions call (bq and gcloud). Its frontmatter pre-approves these tools: Bash(bq:*), Bash(gcloud:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Ga4 Bigquery Export access the network?

SKILL.md names 1 domain. As links in the text: analytics.google.com. This is read from the text; nothing was executed.

Is Ga4 Bigquery Export 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 Bigquery Export use?

Ga4 Bigquery Export 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 Bigquery Export use?

About 2.8k tokens (SKILL.md is roughly 11k 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 Bigquery Export?

Skills that share tags, products or a category with Ga4 Bigquery Export: Imaging Data Commons (K-Dense-AI/scientific-agent-skills, 48k stars), Bigquery Observability (google/skills, 21k stars), Bigquery Optimization (google/skills, 21k stars) and dbt Snowflake to BigQuery Translator (google/skills, 21k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ga4 Bigquery Export?

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.