Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

analytics-tracking

БесплатноБез исполняемых скриптовНе проверен

Designs and implements website analytics tracking with Google Analytics 4 and Google Tag Manager: a written tracking plan, event and parameter names that pass…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub14 установок в других каталогах

Об этом скилле

Analytics Tracking

Overview

Tracking is finished when a named person can answer a business question from a report, not when a tag fires. This skill takes a site from "we have GA4 installed" to a short tracking plan, code that sends each event exactly once with valid names, the Admin settings that make the data usable, and proof that it works. Everything here follows Google's current documentation for GA4, the Google tag and Tag Manager; Universal Analytics concepts (categories, actions, labels, goals, anonymize_ip) do not apply.

Instructions

1. Establish what exists

Ask: which decisions the data should inform, which actions count as success (lead, signup, purchase), which regions the visitors come from (consent), and who is allowed to publish the Tag Manager container. Then look in the code:

grep -rnE "gtag\(|dataLayer\.push|googletagmanager\.com|GTM-[A-Z0-9]{4,}|G-[A-Z0-9]{8,}|@next/third-parties" \
  --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.html" \
  --exclude-dir=node_modules --exclude-dir=.next .

Choose one delivery path and keep to it. If a GTM- container is on the page, send events through the data layer and configure tags in Tag Manager; if only the Google tag is present, call gtag() directly. The same event sent through both paths is counted twice.

2. Pick events from the top of this list down

  1. Already collected. With enhanced measurement on, GA4 records page_view (page loads and browser-history changes), scroll (once per page at 90% depth), click (outbound links only), view_search_results, video_start / video_progress / video_complete (embedded YouTube), file_download, form_start and form_submit. Do not re-implement these.
  2. Recommended events. Use Google's exact names and parameters so built-in reports fill in: sign_up and login (method), generate_lead (currency, value, lead_source), search (search_term), view_item, add_to_cart, begin_checkout, add_payment_info, purchase (transaction_id, currency, value, items).
  3. Custom events, only when nothing above fits. One name per action, with the variation in parameters: cta_click with cta_location: "pricing_hero", not a separate event name per button.

Names must pass these limits; GA4 does not log what exceeds them, and nothing in the browser reports an error:

Item Rule
Event name Starts with a letter; letters, digits and underscores only; case-sensitive; 40 characters
Parameters 25 per event; name 40 characters; value 100 characters (page_location 1,000, page_referrer 420, page_title 300)
User properties 25 per property; name 24 characters; value 36 characters
Reserved Parameter names starting with _, firebase_, ga_, google_ or gtag.. Do not reuse automatic names (click, scroll, session_start, first_visit, user_engagement, form_submit, file_download) for custom events
Per standard property 30 key events, 50 event-scoped and 25 user-scoped custom dimensions, 50 custom metrics

Money: value is a number, never a string, and always travels with currency (ISO 4217, "USD"). For purchase, value is the sum of price × quantity and excludes shipping and tax; transaction_id is required and is what keeps a repeated purchase from being counted again.

3. Write the tracking plan

Create docs/tracking-plan.md with one row per event: event name, the exact moment it fires (a server-confirmed success, not a button press), parameters with example values, whether it is a key event, and which path sends it. Example 1 shows the format. Every later step works from this file.

4. Implement

Google tag with consent defaults. The consent default must run before the tag loads; the order of these blocks is the point.

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('consent', 'default', {
    ad_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied',
    analytics_storage: 'denied',
    wait_for_update: 500
  });
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-7KQ2M4XW9P"></script>
<script>
  gtag('js', new Date());
  gtag('config', 'G-7KQ2M4XW9P');
</script>

When the visitor answers the banner, the consent tool calls gtag('consent', 'update', { analytics_storage: 'granted', ... }) with all four types, and repeats that on later pages from the stored choice. Add region: ['ES', 'FR'] to a default to scope it; the most specific region wins. Which defaults to set is the site owner's legal decision, not a technical one. In Tag Manager, use a consent template from the Community Template Gallery (or the consent APIs in a custom template), never a Custom HTML tag.

Events with gtag.js go anywhere below the snippet: `gtag('event', 'generate_lead', { currency: 'USD', value: 180, lead_source: 'demo_form

Полный SKILL.md на GitHub

Установить analytics-tracking в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл analytics-tracking?

Designs and implements website analytics tracking with Google Analytics 4 and Google Tag Manager: a written tracking plan, event and parameter names that pass GA4's rules, gtag.js or data-layer code, key events, consent mode, UTM conventions, and a verification pass. Use when someone says "set up GA4", "add conversion tracking", "track this form or button", "write a tracking plan", "GTM data layer", "UTM parameters", "why are my events missing or counted twice", or "audit our analytics setup".

Как установить скилл analytics-tracking?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл analytics-tracking запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить analytics-tracking с