google-analytics-4

google-analytics-4 is a skill for Claude Code, Codex from ziniman/ai-instruct. It costs 118 tokens per session (5,235 once invoked), scanned A, original, Apache-2.0.

A guide to Google Analytics 4, Google's current system for measuring website and app visits, events, purchases, and conversions.

In plain words
What is it for?
Use it to install GA4, track events and online sales, configure user properties, handle single-page app page views, and connect consent or advertising signals.
Why use it?
It helps set up tracking correctly, including consent requirements for visitors in the European Union, European Economic Area, or United Kingdom.

Skill for Claude CodeCodex

Part of the ai-instruct plugin — 5 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ziniman/ai-instruct/google-analytics-4
Any agent
npx skills add ziniman/ai-instruct --skill google-analytics-4
Clone the repo
git clone --depth 1 https://github.com/ziniman/ai-instruct

Made for: Claude Code, Codex.

Or install ai-instruct, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for google-analytics-4

README.md
[![agentmods](https://agentmods.dev/badge/skills/ziniman/ai-instruct/google-analytics-4.svg)](https://agentmods.dev/skills/ziniman/ai-instruct/google-analytics-4)
Your own site
<a href="https://agentmods.dev/skills/ziniman/ai-instruct/google-analytics-4"><img src="https://agentmods.dev/badge/skills/ziniman/ai-instruct/google-analytics-4.svg" alt="Measured on agentmods" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,235 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00118 $0.05235
Opus 5 $0.00059 $0.02618
Sonnet 5 $0.00024 $0.01047
Haiku 4.5 $0.00012 $0.00524

Measured 4d ago against content hash 33cff546e77e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

google-analytics-4 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/google-analytics-4/SKILL.md · 538 lines

How it starts

The opening of the file, as written. The whole thing — 538 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Google Analytics 4 Implementation Guide

Applies to: Any website or web app | Updated: February 2026

A practical guide for implementing Google Analytics 4 (GA4) - covering installation, critical first-time setup, event tracking, e-commerce, consent, and advanced topics. Written for AI coding assistants: skip sections that don't apply to the user's setup.

Note: Universal Analytics (UA / GA3) was fully sunset in 2024. GA4 is the only current Google Analytics product.


Section 0: Before You Start

Answer these questions before writing any code. They determine which sections apply.

Q: Are any of your visitors in Europe (EU/EEA) or the UK? Default: no - if yes, Consent Mode v2 setup is required (see Consent Mode v2)

Q: Do you run Google Ads (search, display, YouTube, or Shopping)? Default: no - if yes, ad consent signals matter for conversion tracking and which events you mark as conversions

Q: Is your site a single-page app (React, Vue, Angular, Next.js, etc.) where the URL changes without a full page reload? Default: check the project for package.json, next.config.*, vite.config.*, angular.json, or nuxt.config.* - if found, assume SPA and apply the Single-Page Apps section automatically

Q: Do you need to track purchases or sales? Default: no - skip E-commerce Tracking if no

Q: Do you already have a GA4 property, or is this a fresh start? Default: fresh start - if fresh start, create a property at analytics.google.com before writing any code

Q: Do you use Google Tag Manager, or add the tracking code directly? Default: direct gtag.js - recommend GTM only if the user has a marketing team managing multiple tags

AI assistant: Use these answers to skip irrelevant sections. Do not implement Consent Mode unless the user confirms EU/EEA/UK users. Do not implement e-commerce unless confirmed. If a SPA framework is detected in the project, automatically apply the SPA page_view section. Do not add anonymize_ip - it is a no-op in GA4 (see Common Pitfalls).

Read the full file on GitHub · 538 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 538 lines · 118 tokens per session scan A 33cff546e77e

Subscribe to this mod's changes

google-analytics-4 is a skill published in the GitHub repository ziniman/ai-instruct (28 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 118 tokens to every session and 5,235 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

watch

File sentinel that monitors the working directory for changes and marker comments, then auto-triggers appropriate skills. Poll-based via git diff against the last scan commit. Writes intake items for batch processing and routes marker actions through /do. Use for automatic reactions to file changes; do NOT use for…

SethGammon/Citadel · 70 tokens

review

5-pass structured code review — correctness, security, performance, readability, consistency.

SethGammon/Citadel · 17 tokens

live-preview

Mid-build visual verification loop. Takes screenshots of components during construction, not just after. Catches visual regressions and invisible features before they compound. Requires Playwright or similar screenshot tool.

SethGammon/Citadel · 40 tokens

marshal

Meta-orchestrator that takes any direction — broad, specific, or vague — and autonomously chains skills and context into actionable work. Gathers context from codebase, docs, and memory. Only asks the user when it genuinely cannot proceed. Single-session orchestrator.

SethGammon/Citadel · 56 tokens

wiki

Markdown-first knowledge base where the LLM acts as librarian. Ingests raw sources, compiles and interlinks topic files, self-maintains an index. No vector DB or embeddings required -- uses LLM-native navigation over structured markdown up to 400K words.

SethGammon/Citadel · 56 tokens

finance-investor-relations

투자 유치를 위한 IR 피치덱과 3개년 재무 모델(매출 예측·손익·현금흐름·밸류에이션)을 만들어 드립니다. 다음과 같은 요청 시 사용하세요: "IR 덱 만들어줘" "투자자 피치 자료 써줘" "재무 모델 만들어줘" "매출 예측 좀 해줘" "밸류에이션 계산해줘" "시리즈 A 투자 유치 자료 준비해줘" "투자자 보고서 정리해줘" 투자 단계(Pre-SeedSeries B)에 맞춘 12슬라이드 피치덱·재무 모델·예상 질문 Q&A를 만들고, PPT/엑셀 변환으로 이어집니다.

modu-ai/moai-cowork · 180 tokens