wp2next tracking
Rebuilds a site's analytics checklist (and the Google Tag Manager import file, when the site uses GTM) from wp2next.json.
| Synopsis | wp2next tracking [--ask] [--consent us-only|consent-mode-v2] [--cmp <provider>] [<key>=<ID> ...] (Claude desktop and Claude Code plugin: /wp2next:tracking; Codex: $wp2next tracking; Cursor: /wp2next tracking) |
|---|---|
| Changes code | No site code. It writes the analytics docs and the tracking part of wp2next.json |
| Touches outside services | No. It never imports, publishes or changes anything in GTM, GA4, the consent banner tool or any vendor; those are your steps, listed in the README it writes |
| Reads | wp2next.json (domain, displayName, tracking), the site's analytics code (read-only check) |
| Writes | docs/analytics/README.md, plus docs/analytics/gtm-container.json when tracking.tagManager is gtm; wp2next.json → tracking |
What it does
- Shows the current setup: analytics tools, tag manager, Search Console, consent mode, consent banner (CMP) and which tags have IDs.
- With
--ask, or when the stack isn't recorded yet, asks the tracking questions. The stack is proposed, not assumed: the Google stack (GA4 + Tag Manager + Search Console) is recommended, and HubSpot, Plausible, Fathom, Matomo, PostHog, Vercel Analytics or none are offered too, alone or combined. It never picks a consent banner for you. A WordPress-only banner plugin (Complianz and similar) has to be replaced, and it explains why. - Asks once for each missing ID, saying where to find it. IDs you don't have yet can stay empty; they're listed under "Still to do". Tracking IDs are public; it never asks for or stores API keys.
- Saves the answers in
wp2next.jsonand validates the file. - Generates the files:
- With GTM: a container import file plus a README with the import, consent and goal steps.
- Without a tag manager: a README for loading each provider directly.
- Checks (read-only) that the site's analytics code still matches
wp2next.json. A mismatch is reported with the file, line and one-line fix; it doesn't edit site code here. - Lists what's left for you: pending IDs, tags to set up by hand, and the next steps in
docs/analytics/README.md(import, consent banner, consent check, key events, Search Console, Bing).
It doesn't commit unless you ask. For titles, descriptions, structured data and sitemaps, use
seo.
Arguments and options
| Argument | Effect |
|---|---|
| (none) | Regenerate the files from wp2next.json |
--ask | Re-ask the tracking questions, then collect IDs |
--consent us-only / --consent consent-mode-v2 | Set the consent setting (US visitors only, or Google Consent Mode v2 with a banner) |
--cmp <provider> | Set the consent banner provider, for example cookieyes |
<key>=<ID> | Set or change one tag or provider ID, then regenerate. <key>.<field>=<value> sets a provider field |
Examples
For Claude desktop
/wp2next:tracking/wp2next:tracking$wp2next tracking/wp2next trackingwp2next tracking --ask: the client wants Plausible instead of GA4; re-answer the questions.wp2next tracking gtm=GTM-XXXXXXX: add the container ID once you have it.wp2next tracking --cmp cookieyes: record the consent banner the client chose.
Related
- Tracking and search · Analytics and tags · Consent banner
compliancechecks the banner against the trackers that actually fire- Configuration: the
trackingkeys - Agent instructions:
references/commands/tracking.md (external site)