Skip to content
wp2next, home
Skip to the page

wp2next tracking

Rebuilds a site's analytics checklist (and the import file, when the site uses GTM) from wp2next.json.

Your AI tool

Commands are shown for Claude desktop, the recommended tool. Pick another if you use a different one; this browser remembers.

Synopsiswp2next 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 codeNo site code. It writes the analytics docs and the tracking part of wp2next.json
Touches outside servicesNo. 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
Readswp2next.json (domain, displayName, tracking), the site's analytics code (read-only check)
Writesdocs/analytics/README.md, plus docs/analytics/gtm-container.json when tracking.tagManager is gtm; wp2next.json → tracking

What it does

  1. Shows the current setup: analytics tools, tag manager, , consent mode, consent banner (CMP) and which tags have IDs.
  2. With --ask, or when the stack isn't recorded yet, asks the tracking questions. The stack is proposed, not assumed: the Google stack ( + 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.
  3. 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 .
  4. Saves the answers in wp2next.json and validates the file.
  5. 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.
  6. 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.
  7. 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 check, key events, Search Console, Bing).

It doesn't unless you ask. For titles, descriptions, structured data and sitemaps, use seo.

Arguments and options

ArgumentEffect
(none)Regenerate the files from wp2next.json
--askRe-ask the tracking questions, then collect IDs
--consent us-only / --consent consent-mode-v2Set 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
Text
/wp2next:tracking
  • wp2next tracking --ask: the client wants Plausible instead of GA4; re-answer the questions.
  • wp2next tracking gtm=GTM-XXXXXXX: add the once you have it.
  • wp2next tracking --cmp cookieyes: record the consent banner the client chose.