register-book-analytics
БесплатноБез исполняемых скриптовНе проверенWires Google Analytics 4 into an MkDocs Material site — creates a GA4 property, writes the Measurement ID into mkdocs.yml, verifies the tag, and deploys. Use…
от dmccreary★ 115 звёзд на GitHubОб этом скилле
Register a Book with Google Analytics (MkDocs Material)
This skill registers a new MkDocs Material site as a Google Analytics 4 (GA4) property,
captures the Measurement ID, writes it into mkdocs.yml, verifies the tag is injected,
and commits/deploys.
Inputs to gather first
Read these from the repo and/or confirm with the user:
- Repo path – local folder containing
mkdocs.yml(e.g.~/Documents/ws/<book>). - Site URL – usually
site_url:inmkdocs.yml(e.g.https://dmccreary.github.io/<book>/). - GA settings (defaults below, override if the user says otherwise):
- Reporting time zone: US / Chicago (GMT-05:00 Chicago Time)
- Business size: Small – 1 to 10 employees
- Industry category: Jobs & Education (GA4 has no literal "Education and Training" option; "Jobs & Education" is the correct closest match — use it unless told otherwise)
- Business objective: Understand web and/or app traffic (best fit for a docs site)
Open mkdocs.yml and confirm there is no existing extra.analytics block before starting.
Step 1 — Create the GA4 property (Claude in Chrome)
Requires the Claude in Chrome extension connected and the user logged into Google Analytics.
- Navigate to
https://analytics.google.com/analytics/web/and wait for it to load. - Open Admin → Create property (or the "Create property" card on Home). This launches a 4-step wizard: Property creation → Business details → Business objectives → Data collection.
- Property creation: enter the property name (match the book's
site_name). Change the Reporting time zone — click the time-zone dropdown, typeChicago, select "(GMT-05:00) Chicago Time". Leave currency as USD. Click Next. - Business details: open the Industry category dropdown, type
Education, select Jobs & Education. Select Small - 1 to 10 employees. Click Next. - Business objectives: check both the following:
- Understand web and/or app traffic
- View user engagement & retention
The action button on this step is labeled Create (not "Next") — click it to create the property.
Step 2 — Create the Web data stream and capture the Measurement ID
The number shown in the stream list (e.g. 15014865793) is the Stream ID, NOT the
Measurement ID. The Measurement ID (format G-XXXXXXXXXX) only appears in the Google tag.
- On the Data collection step choose Web as the platform.
- In "Set up your web stream": set Website URL (protocol
https://+ host/path, e.g.dmccreary.github.io/<book>/) and a Stream name (the book name). Leave Enhanced measurement on. Click Create & continue. - The "Set up a Google tag" panel appears. Read the Measurement ID from the snippet —
it appears as
gtag/js?id=G-XXXXXXXXXXandgtag('config', 'G-XXXXXXXXXX'). - Verify the exact characters by zooming into the code block (don't trust a quick glance;
0/O,1/I,Q/Oare easy to misread). Record theG-...value.
Step 3 — Add the ID to mkdocs.yml
MkDocs Material reads analytics from extra.analytics. If an extra: block already exists,
merge into it rather than adding a second extra: key (duplicate top-level keys break YAML).
extra:
analytics:
provider: google
property: G-XXXXXXXXXX
# ...keep any existing schema/social/etc. keys here...
Step 4 — Build and verify the tag (do this before deploying)
Build to a temporary directory and confirm the ID is injected into the HTML:
cd <repo>
mkdocs build -q -d /tmp/site_verify # mkdocs-material must be installed
grep -c "G-XXXXXXXXXX" /tmp/site_verify/index.html # expect >= 1
grep -o "googletagmanager.com/gtag/js?id=G-XXXXXXXXXX" /tmp/site_verify/index.html
A non-zero count confirms Material picked up the analytics config.
Step 5 — Commit, push, deploy
cd <repo>
git add mkdocs.yml
git commit -m "Add Google Analytics property G-XXXXXXXXXX to mkdocs.yml"
git push origin main
mkdocs gh-deploy # builds and pushes the site to the gh-pages branch
After deploy, optionally confirm the live tag:
curl -s https://dmccreary.github.io/<book>/ | grep -o "G-XXXXXXXXXX".
Environment notes / known limitations
These matter when running inside the Cowork sandbox (vs. the user's own terminal):
- GitHub credentials: the Cowork Linux sandbox has no push credentials.
git pushandmkdocs gh-deploy(which pushes togh-pages) will fail with "could not read Username for https://github.com". When this happens, do the GA registration, themkdocs.ymledit, the build-verify, and the localgit commit, then hand the user the exactgit push/mkdocs gh-deploycommands to run in their own terminal. - Mount delete restrictions: the sandbox mount may forbid deleting files. This can (a) break
mkdocs buildinto the existingsite/dir (build to a temp dir instead, as in Step 4), and
Установить register-book-analytics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл register-book-analytics?
Wires Google Analytics 4 into an MkDocs Material site — creates a GA4 property, writes the Measurement ID into mkdocs.yml, verifies the tag, and deploys. Use when adding analytics to a textbook for the first time.
Как установить скилл register-book-analytics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл register-book-analytics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic