Skip to content
wp2next, home

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

Cost

Google's tools and PostHog's free tier cost nothing, and 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 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 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 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.

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).

OptionCostGood for
Google stack: + Tag Manager + Search Console (recommended)FreeMost sites, and any site that runs or might run Google Ads
Free CRM tools; Google Ads sync needs a paid Marketing Hub plan (pricing⁠ (external site))Leads already live in HubSpot
PlausibleFrom $9/month (pricing⁠ (external site))A simple dashboard without cookies
FathomFrom $15/month (pricing⁠ (external site))A simple dashboard without cookies
MatomoSelf-hosted is free; Cloud from €29/month (pricing⁠ (external site))Detailed reports while you own the data
PostHogFree up to 1M events a month (pricing⁠ (external site))Funnels and session replay as well
Vercel Web AnalyticsIncluded with Vercel; custom events need Pro (limits⁠ (external site))Simple visit counts only
NoneFreeYou 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

  1. 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).
  2. 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.
  3. Choose Web, enter your address (https://example.com) and a name, and click Create stream.
  4. Copy the . 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: loads Analytics for you.

3. Create your Tag Manager container

  1. Go to google.com, tagmanager.google.com⁠ (external site). Create an account (your business name and country) if you don't have one.
  2. Create a container: name it after your domain, choose Web, click Create, accept the terms.
  3. Close the window with the install code, and copy the . 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:

  1. "How should this site measure visitors?" The recommended answer is the Google stack. Pick it, or another tool, or none.
  2. Whether to verify the domain with Google Search Console and . Say yes to both.
  3. Which ad tags you need (Google Ads, Meta Pixel, LinkedIn Insight, Microsoft Ads) and any others, such as Microsoft Clarity or call tracking.
  4. For the IDs: paste the G- and GTM- IDs from steps 2 and 3, and any ad tag IDs. These IDs aren't . 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.

For Claude desktop
Text
/wp2next:tracking

(In Claude, type /wp2next tracking if you installed wp2next without the plugin.)

5. Import the file into Tag Manager

  1. In Tag Manager, open your container and click Admin → Import container.
  2. Click to choose the file, go to your project folder → docs → analytics, and pick gtm-container.json. Can't find the folder? Ask your AI tool to open it for you.
  3. Choose the existing Default Workspace, then Merge, then Rename conflicting tags, triggers, and variables. This never replaces anything already in the container.
  4. 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 , 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

  1. Go to google.com, search.google.com, search console⁠ (external site), click Add property, choose Domain and type your domain without https:// or www, like example.com.
  2. Google shows a line of text that starts with google-site-verification=. Copy it.
  3. Add it as a new 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 starting v=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 during migrate, and Go live explains how to find out. If someone else manages your DNS, send them the text and these instructions.
  4. 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 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:

  1. 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.
  2. Back in the tab, click Continue and check that the lead (generate_lead) shows up once.
  3. Click Submit → Publish and Create Version → give it a name like "Launch" → Publish.

After launch, in Search Console, open 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)