Analytics and tags
Optional
- Time
a few minutes of questions in the interview, plus about an hour in Google's websites, plus up to a few days waiting for Google to confirm your domain
- Cost
Google's tools and PostHog's free tier cost nothing, and Vercel Web Analytics comes with Vercel; privacy-first tools from $9/month (below)
- You need
a Google account your business controls, and access to wherever your domain's DNS is managed (or the person who has it)
Not done yet. Tick it at the end of the page.
Analytics tells you how many people visit your site and how many of them get in touch. Tags are small scripts from ad platforms such as Google Ads, Meta or LinkedIn that measure your ads. wp2next can set these up on the new site, carry over the ones your WordPress site already has, and register the site with Google Search Console and Bing so you can see how search engines treat it.
You create the accounts in Google's websites and click Import and Publish. Your AI tool writes everything that goes into the site.
Commands are shown for Claude desktop.
When you'd want it
- You want to know how many visits and leads the site gets.
- You run Google Ads or other ads, and the ad platform needs to know which clicks became leads.
- Your WordPress site already has analytics. Keeping the same account keeps your history.
Search Console is worth it even if you skip analytics. It is free and it's the only way to see how Google and Bing see the site after the move.
What it costs
Prices checked 2026-12 (tracking guide has every source).
| Option | Cost | Good for |
|---|---|---|
| Google stack: Google Analytics 4 + Tag Manager + Search Console (recommended) | Free | Most sites, and any site that runs or might run Google Ads |
| HubSpot | Free CRM tools; Google Ads sync needs a paid Marketing Hub plan (pricing (external site)) | Leads already live in HubSpot |
| Plausible | From $9/month (pricing (external site)) | A simple dashboard without cookies |
| Fathom | From $15/month (pricing (external site)) | A simple dashboard without cookies |
| Matomo | Self-hosted is free; Cloud from €29/month (pricing (external site)) | Detailed reports while you own the data |
| PostHog | Free up to 1M events a month (pricing (external site)) | Funnels and session replay as well |
| Vercel Web Analytics | Included with Vercel; custom events need Pro (limits (external site)) | Simple visit counts only |
| None | Free | You don't want analytics |
The Google stack is what wp2next suggests, but it doesn't assume it: you choose. The steps below are for the Google stack. If you pick another tool, the AI tool tells you what to do in that tool's website, and you still do the Search Console part (steps 6 and 7).
"Without cookies" doesn't automatically mean "no consent needed" in Europe. If you have visitors from the EU, UK or Switzerland, read Consent banner.
Do this
Google renames its menus from time to time. The clicks below were checked in December 2026; if a button has moved, look for the nearest match. Every click, with Google's own help page for it, is in the Google tracking setup guide.
1. Use a Google account your business owns
Sign in to Google with an account the business controls: an address on your own domain (for example
marketing@example.com) if you have Google Workspace, otherwise a Gmail account made just for the
business. Not someone's private inbox. Everything you create below belongs to that account.
Each website gets its own property. If you already have a Google Analytics account for your business, add the new site as a new property inside it. Don't put it in someone else's account (an old web designer's, an agency's), and don't mix two websites in one property. (Why)
Already have Google Analytics on your WordPress site? Keep using that property. Skip to step 3 and tell the AI tool you already have it.
2. Create your Google Analytics property
- Go to google.com, analytics.google.com (external site). Click Start measuring (first time) or Admin → Create → Property (if your business already has an account).
- Enter your business name, then your website's name, your time zone and your currency. Answer the questions about your business and click Create. Accept Google's terms.
- Choose Web, enter your address (
https://example.com) and a name, and click Create stream. - Copy the Measurement ID. It starts with
G-. You'll paste it when the AI tool asks.
Google then offers you some code to add to your site. Skip it: Tag Manager loads Analytics for you.
3. Create your Tag Manager container
- Go to google.com, tagmanager.google.com (external site). Create an account (your business name and country) if you don't have one.
- Create a container: name it after your domain, choose Web, click Create, accept the terms.
- Close the window with the install code, and copy the container ID. It looks like
GTM-XXXXXXX.
If your WordPress site already uses Tag Manager, you can use that container instead. The AI tool warns you before anything is published to it, because publishing changes the live WordPress site too.
4. Answer the questions in the interview
During migrate (step 6), wp2next looks at your WordPress site and tells you what
it found, for example "WordPress loads Google Analytics through Tag Manager". Then it asks:
- "How should this site measure visitors?" The recommended answer is the Google stack. Pick it, or another tool, or none.
- Whether to verify the domain with Google Search Console and Bing Webmaster Tools. Say yes to both.
- Which ad tags you need (Google Ads, Meta Pixel, LinkedIn Insight, Microsoft Ads) and any others, such as Microsoft Clarity or call tracking.
- For the IDs: paste the
G-andGTM-IDs from steps 2 and 3, and any ad tag IDs. These IDs aren't secret. If you don't have one yet, say so: you can add it later.
init asks the same tracking question once to set your usual choice. You still confirm it for each
site.
wp2next then writes a file called gtm-container.json in your project folder, in docs → analytics,
with every tag already set up, plus a README.md checklist next to it for your exact setup.
To change your choices later, or to add an ID you didn't have, run the tracking command. In the Claude desktop app, open your site's project folder in the Code tab first.
/wp2next:tracking/wp2next:tracking$wp2next tracking/wp2next tracking(In Claude, type /wp2next tracking if you installed wp2next without the plugin.)
5. Import the file into Tag Manager
- In Tag Manager, open your container and click Admin → Import container.
- Click to choose the file, go to your project folder →
docs→analytics, and pickgtm-container.json. Can't find the folder? Ask your AI tool to open it for you. - Choose the existing Default Workspace, then Merge, then Rename conflicting tags, triggers, and variables. This never replaces anything already in the container.
- Click Continue, then Confirm.
Nothing goes live yet. You publish at launch, when the AI tool asks you to (step 9).
If your site needs a consent banner, the README.md checklist says whether you add it in Tag Manager
too, and how. See Consent banner.
6. Verify your domain with Google Search Console
- Go to google.com, search.google.com, search console (external site), click Add
property, choose Domain and type your domain without
https://orwww, likeexample.com. - Google shows a line of text that starts with
google-site-verification=. Copy it. - Add it as a new TXT record wherever your domain's DNS is managed. Leave the name blank (or
@) and paste the text as the value. Don't edit or replace a TXT record that's already there, especially one startingv=spf1: that one is your email's SPF, and overwriting it can send your email to spam. A domain can have several TXT records at@. Before you add it, save a copy (screenshot or export) of all your DNS records, as in Go live, step 2. Not sure where your DNS is? The AI tool asks about it duringmigrate, and Go live explains how to find out. If someone else manages your DNS, send them the text and these instructions. - Click Verify. It can take two or three days before Google sees the record. If it fails, try again a day or two later.
Never delete that TXT record, even years from now. Google checks it again, and you lose access to Search Console without it.
7. Add Bing
Go to bing.com, webmasters (external site), sign in, choose Import and connect your Google Search Console account. Bing verifies your site from there. No extra DNS record needed.
8. Give access to the people helping you
If an agency, a freelancer or a developer is helping, invite them. Never send them your Google password or a sign-in code. Each tool has its own invite screen:
- Google Analytics: Admin → Property access management → + → Add users → their email → Editor → Add.
- Tag Manager: Admin → Account User Management → + → their email, with Publish on your container (Not yet confirmed: check the labels in the UI).
- Search Console: Settings → Users and permissions → Add user → their email → Full.
- Google Ads: accept their manager account's request to link (Admin → Access and security; Not yet confirmed: check the labels in the UI).
They accept the invitation by email. You can remove them at any time from the same screens. The setup guide has the details, and handing over covers taking access back at the end.
9. At launch: publish
During go-live, the AI tool turns tracking on and asks you to test and publish Tag Manager:
- In Tag Manager, click Preview, enter the site address, and click Connect. On the site that opens, send a test message through the contact form.
- Back in the Tag Assistant tab, click Continue and check that the lead (
generate_lead) shows up once. - Click Submit → Publish and Create Version → give it a name like "Launch" → Publish.
After launch, in Search Console, open Sitemaps and submit sitemap.xml.
You'll know it worked when
- Until launch, analytics is switched off on purpose, so test visits don't count.
- After launch, Google Analytics' Realtime report shows your own visit from your phone (on mobile data, not office Wi-Fi), and a test form message shows up as one lead.
- Search Console shows your domain as verified, and later accepts your sitemap.
- Bing lists your site under My Sites.
If something goes wrong
- Search Console says it can't find the record: wait a day or two and click Verify again. Check you added it where your DNS is actually managed.
- The import fails: run the tracking command again and import the new file. Don't edit the file.
- A button isn't where this page says: Google moved some Tag Manager menus in 2026. See the setup guide.
- The full setup and an after-launch checklist are in the tracking guide.
- See If it stops and troubleshooting.
This page is docs/start/optional/analytics-and-tags.md in the wp2next repository. Read or edit it on GitHub (external site)