Skip to content
wp2next, home
Skip to the page

Google tracking setup: GA4, Tag Manager and Search Console, step by step

Your AI tool

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

Your computer

Pick your computer's system. Steps that differ switch to it, and this browser remembers.

For people running migrations (freelancers, agencies, developers), and for site owners who want the exact clicks. The plain-language version is Analytics and tags. Why wp2next recommends this stack, the alternatives and the consent rules are in Tracking and search.

This page walks through the Google side of a wp2next site in the order you do it: (GA4), Google Tag Manager (GTM), Search Console, the links between them, and Bing Webmaster Tools.

The Google stack is recommended, not required. wp2next proposes it during migrate and you can pick another analytics tool, or none (see Choosing a tracking stack). and Bing are worth setting up whatever you pick: skip straight to step 8 if you don't use GA4 or GTM.

Every click path on this page was checked against Google's, Microsoft's and Vercel's help pages in December 2026 (checked 2026-12), with the source linked under each step. Google renames menus often. Steps marked Not yet confirmed weren't confirmed on an official page, and the words on your screen may differ: look for the nearest match. Everything here happens in a web browser, so it's the same on macOS and Windows, except the check in step 8, which has a block for each.

Before you start

Use a Google account the business controls

The business should create and own every Google property (GA4, , Search Console, Google Ads). This is best practice, not a Google rule, but it saves a painful transfer later (Handing a site over to the client).

  • Sign in with a Google Workspace address on the business's own , for example marketing@example.com, if the business has Google Workspace. Otherwise create a dedicated business Gmail account. Avoid one person's private inbox.
  • Add a second person from the business as an administrator on each product, so nobody gets locked out when someone leaves.
  • People helping with the site (an agency, a freelancer, a developer) get their own access by invitation, never the business's password. See step 2.

One property per site, in the right account

Each Google product has a container for the business and a smaller one per website. Put each new site in the business's own account, as its own property:

ProductThe business getsEach website gets
GA4One accountOne property with one web data stream
Tag ManagerOne accountOne container (target platform: Web)
Search Console(no account level)One Domain property, for example example.com
  • Don't add a client's site to an agency's own GA4 or GTM account, and don't add it to another business's account. Access to the account level reaches every property in it (GA4 access⁠ (external site)).
  • Don't put two websites in one . Their numbers mix and can't be separated afterwards.
  • Reuse what already exists. If the WordPress site already has a GA4 property, keep it: a new property starts with no history. Moving a property that sits in the wrong account is covered in Handing a site over to the client.

Have these ready

  • The domain (example.com), the business's time zone and reporting currency.
  • Who manages the domain's DNS (where the are edited). It's often the registrar, but not always. The DNS cutover guide helps you find out.
  • The project folder on your computer. wp2next writes the Tag Manager import file into it (step 5).
  • Office IP addresses, if staff visits should be filtered out.
  • Whether visitors come from the EU, UK or Switzerland. That decides whether you need step 6.

1. Create the GA4 account and property

Source: Set up Analytics for a website⁠ (external site) (checked 2026-12).

  1. Go to google.com, analytics.google.com⁠ (external site) signed in as the business.
    • First time: click Start measuring.
    • Already has an account for this business: go to Admin → Create → Property and skip to step 3. To create a new account instead: Admin → Create → Account.
  2. Account: enter the business name as the account name, review the data-sharing settings, click Next.
  3. Property: enter a property name (the domain works well), the reporting time zone and the currency → Next → choose the industry category and business size → Next → choose how you plan to use Analytics → Create → accept the Terms of Service and the Data Processing Amendment.
  4. Web : Admin → Data collection and modification → Data streams → Add stream → Web. Enter https://example.com and a stream name. Leave Enhanced measurement on (step 3 below adjusts it) → Create stream.
  5. Copy the : Admin → Data streams → click the stream → under Stream details, copy the ID that starts with G-. wp2next asks for it.

Don't add the Google tag code Google offers at the end. On a wp2next site GA4 is loaded by Tag Manager, from the container you import in step 5.

2. Invite the people helping you

Invitations go to the helper's own Google account. Never share the business's password or a 2-step verification code, and don't let anyone sign in "as" the business. Each product has its own invite screen, so do this for each product once it exists (GTM after step 4, Search Console after step 8).

ProductWhereRole to give a helperSource (checked 2026-12)
GA4Admin → Property access management (or Account access management) → + → Add users → email → role → AddEditor on the property. Add at property level, not account level, when the account holds other sitesGoogle⁠ (external site)
Tag ManagerAdmin → Account → User Management → + → email → account role, plus Publish on this container. Path Not yet confirmed (check in the UI)User on the account, Publish on the containerGoogle⁠ (external site)
Search ConsoleSettings → Users and permissions → Add user → email → permissionFull. To link GA4 (step 9) they must be a verified owner, so either the business makes the link or the helper verifies with their own TXT record; a delegated Owner is not enoughGoogle⁠ (external site)
Google AdsThe business's Ads account links to the helper's manager (MCC) account: Admin → Access and security → Managers. Path Not yet confirmed (check in the UI)Manager link (the business can remove it any time)Google⁠ (external site)
Bing Webmaster ToolsUser management → add user. Not yet confirmed (check in the UI): not researchedAdministrator or a lower role (Not yet confirmed)Microsoft⁠ (external site)

Notes on roles:

  • GA4 names Administrator, Editor and Viewer roles on its access page. Creating a new event as a key event needs Marketer or above, and linking Google Ads needs Editor or Administrator. Editor covers everything on this page except managing users. Only email addresses tied to a Google Account can be added. The last Administrator can't remove themselves.
  • Search Console has four levels: Owner, Full, Restricted and Associate. An owner can add another delegated owner directly.
  • Search Console allows 100 non-owner users per property.

The helper accepts each invitation by email. What the business sends the helper is: the accepted invitations, the domain, who runs DNS, and the time zone and currency. No passwords.

3. GA4 settings to change on day one

Data retention

Admin → Property → Data Settings → Data Retention. Your screen may show these under Data collection and modification instead (label Not yet confirmed). Needs Editor.

  • Set Event-level data to 14 months (standard properties offer 2 or 14) → Save.
  • There is a separate User-level data setting (also 2 or 14 months). Key-event data follows that one, so set it to 14 months too.
  • It affects Explorations and funnel reports, not the standard reports. Google waits 24 hours before applying a change, and you can undo it in that window. A reduction deletes data at the next monthly deletion.

Source: Data retention⁠ (external site) (checked 2026-12).

Enhanced measurement

Admin → Data streams → your stream → the Enhanced measurement gear:

  • Turn Form interactions off. It can fire on submits that didn't succeed (Not yet confirmed). The wp2next site sends generate_lead itself, only when a form is sent successfully.
  • Leave Page changes based on browser history events on. A wp2next site changes pages without a full reload, and this is how GA4 counts those page views.

Source: Enhanced measurement⁠ (external site) (checked 2026-12).

Filter out staff visits

Source: Internal traffic⁠ (external site) and Data filters⁠ (external site) (checked 2026-12).

  1. Admin → Data streams → your stream → Configure tag settings → Show more → Define internal traffic → Create. Keep traffic_type = internal, choose the IP match type, enter the office IP address → Create.
  2. Admin → Data filters → Create filter → Internal traffic → Exclude. Leave the state on Testing for a few days.
  3. Once the test looks right, switch the filter to Active. Filters take 24–36 hours to start working, and data an active filter excludes is gone for good.

The same list has a Developer traffic filter, which removes debug-mode visits such as sessions.

Other domains

If visitors pass through another domain on the way to a lead (a booking or payment site), add it under Configure tag settings → Configure your domains. (Google⁠ (external site), checked 2026-12)

Key events (mark what counts as a lead)

Source: Key events⁠ (external site) (checked 2026-12).

  • Before any data arrives: Admin → Data display → Events → + Create event → enter the exact name generate_lead → turn on Mark as . Needs Marketer or above.
  • After the event has fired once: Admin → Data display → Events, then click the star next to generate_lead (in the Recent events tab, or search for it). Needs Editor or above.
  • Add contact_click too if the business counts phone and email taps as leads. To count only phone taps, create an event named for example phone_click that matches event_name = contact_click and method = phone, and mark that one instead.
  • Counting starts when you mark the event, with no backfill. Key events show in Realtime within a few minutes and in standard reports within 24 hours. A standard property allows 30 key events.
  • Register the event parameters as event-scoped custom dimensions (Admin → Custom definitions) so they show in reports: method, link_location, and the lead parameters (form_type, form_location by default). (Google⁠ (external site))

4. Create the Tag Manager container

Steps Not yet confirmed (Google's standard flow; check in the UI).

  1. Go to google.com, tagmanager.google.com⁠ (external site) signed in as the business.
  2. If the business has no Tag Manager account: Create account → account name (the business) and country. If it has one, open it and choose to create a new container.
  3. Container name: the domain. Target platform: Web → Create → accept the terms.
  4. Close the install-code window. wp2next adds the container to the site itself.
  5. Copy the (GTM-XXXXXXX) from the top of the workspace. wp2next asks for it.

If the WordPress site already uses a container, you can reuse it. Read the warning in step 7 first.

5. Import the wp2next container

wp2next writes a ready-made container file with every tag, trigger and variable your site needs: the GA4 tag and events, Google Ads conversions if you use Ads, and any extra tags you chose. You import it instead of building tags by hand.

Generate the file

migrate generates it during 5. To generate it again after a change (a new ID, a new tag), open your site's project and run the tracking command. It asks for any ID it doesn't have yet.

For Claude desktop

Open the Claude desktop app, click Code, choose Local and your site's project folder with Open folder…, then type:

Text
/wp2next:tracking

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

It writes two files in the project folder:

  • docs/analytics/gtm-container.json: the import file.
  • docs/analytics/README.md: a checklist for your exact setup, including anything still to do.

Read what it reports. PENDING lines are IDs you haven't given yet, and those tags aren't in the file. MANUAL lines are tags you need to add by hand. Don't edit the JSON file by hand; rerun the command instead. More on the command: wp2next tracking.

Import it

Source: Import a container⁠ (external site) (checked 2026-12).

  1. In Tag Manager, open the container → Admin → Import container.
  2. Choose container file → go to your project folder → docs → analytics → gtm-container.json. If you can't find the folder, ask your where the project is, or to open the docs/analytics folder for you.
  3. Choose Existing workspace: Default Workspace.
  4. Choose Merge, then Rename conflicting tags, triggers, and variables. This is safe for any container: nothing that's already there is replaced. (Overwrite replaces the whole container; only use it on a brand-new, empty one.)
  5. Click Continue, read the summary of what will be added or changed, then click Confirm.

Imported tags reach the site only when you publish (step 7).

If you change something later and regenerate the file, import it again the same way. Renamed duplicates (with a suffix) mean a tag existed under the same name: delete the older copy.

Only if the site has visitors from the EU, UK or Switzerland (tracking.consent is consent-mode-v2). Background: Consent and Consent banner. Source for this step: Consent mode in Tag Manager⁠ (external site) (checked 2026-12).

wp2next connects the banner (a ) in one of two ways, and docs/analytics/README.md says which one your site uses:

  • Script in the site's code: nothing to add in Tag Manager. The site sets the "denied" defaults, then loads the banner, then Tag Manager.
  • Tag Manager template: add the banner here:
    1. Templates → Tag templates → Search gallery, and find your banner service's template (gallery labels Not yet confirmed; the template names are in the comparison table). Check the publisher name before adding it.
    2. Tags → New → choose the template → enter the site ID from the banner service.
    3. Set the default (denied) consent for the EU, UK and Switzerland in the template's settings.
    4. Trigger: the built-in Consent Initialization - All Pages. Only consent tags use this trigger.

Either way:

  • Never add a Custom HTML tag that sets consent defaults, and never set defaults in both the site and a template. wp2next's container doesn't include one.
  • Turn on Admin → Container Settings → Additional Settings → Enable consent overview. A shield icon then appears on the Tags list and shows which consent each tag waits for.
  • has four signals: ad_storage, analytics_storage, ad_user_data and ad_personalization. Google's tags read them automatically. The other tags in wp2next's container are already set to wait for the right consent (Tag → Advanced Settings → Consent Settings).

7. Test and publish

If the WordPress site uses the same container, publishing changes the live WordPress site's tags too. Publish only at launch, or use a new container for the new site. migrate tells you before it asks you to publish (step 7: Go live).

Until launch, analytics is switched off on the preview site on purpose. During , the AI tool turns it on for the private Vercel address first, so you can test there before the domain moves.

Preview with Tag Assistant

Source: Preview and debug⁠ (external site) (checked 2026-12).

  1. In the workspace, click Preview. Tag Assistant opens in a new tab.
  2. Enter the site address and click Connect. If the site misbehaves, untick Include debug signal in the URL and connect again.
  3. The site opens in a new window. Accept the consent banner if there is one.
  4. Submit a test form, tap a phone link, and click through to a second page.
  5. Go back to the Tag Assistant tab and click Continue. Check:
    • the GA4 tag fired on the first page;
    • generate_lead fired once, after the form was sent;
    • contact_click fired when you tapped the phone link;
    • each extra tag fired once, and again on the second page if it needs page views;
    • the Consent tab shows the consent states you expect.

Publish

Source: Publish⁠ (external site) (checked 2026-12).

  1. Click Submit.
  2. Choose Publish and Create Version, enter a version name (for example "v1 launch") and a description.
  3. Click Publish.

Publishing needs Publish permission on the container (standard Tag Manager behavior; the help page doesn't state it outright). Create Version (finished with Create) saves a snapshot without making it live.

The 2026 Tag Manager changes

In August 2026 Google announced that Google tags and Tag Manager are merging (Google⁠ (external site), checked 2026-12):

  • Containers get a simpler Overview page with a Settings tab for container-wide settings. Triggers, Variables, Templates and Folders move into a new Advanced section. If a menu on this page isn't where we say, look there.
  • Editors may see a banner offering to optimize the container. Google says no changes are made automatically by this flow; you can preview first. If you accept it, test again in Preview before publishing, and check the consent settings, which Google's page doesn't cover.
  • Google's page doesn't say clearly whether the upgrade of standalone Google tags is automatic, and gives no date. A report of a January 2027 upgrade date is Not yet confirmed.
  • Importing the wp2next container still works the same way.

8. Verify the domain in Search Console

Do this whatever analytics you chose. It can be done before launch: it only adds a DNS record and doesn't change where the domain points.

Source: Verify site ownership⁠ (external site) (checked 2026-12).

  1. Go to google.com, search.google.com, search console⁠ (external site) signed in as the business → Add property → Domain → enter example.com (no https://, no www). Labels Not yet confirmed. A covers every version of the site: with and without www, http and https.
  2. Copy the Google shows (it starts with google-site-verification=). Leave the page open.
  3. Add it where the domain's DNS is managed (not necessarily the ): Type TXT, Name/Host blank or @ (whichever the DNS host uses for the domain itself), Value = the string. Add a new TXT record. Don't edit or replace an existing TXT record, especially one starting v=spf1 (the domain's email SPF): a domain can have several TXT records at @, and overwriting the SPF record sends the business's email to spam or gets it rejected. Save a copy (export or screenshot) of the DNS records before adding anything (DNS cutover → Copy every record).
    • DNS on Vercel (the domain uses Vercel's ): Vercel dashboard → Domains → click the domain → on its Advanced Settings page click Enable Vercel DNS → in the DNS record form, Name blank, Type TXT, Value the string, TTL 60 (the default) → Add. (Vercel⁠ (external site), checked 2026-12) Or from the project folder:
      Terminal
      vercel dns add example.com '@' TXT "google-site-verification=..."
      (Vercel CLI⁠ (external site), checked 2026-12)
    • Anywhere else (registrar, Cloudflare, old web host): add a TXT record in that provider's DNS settings. The DNS cutover guide covers finding the .
  4. Back in Search Console, click Verify. Google says a new record can take 2–3 days to start working. If it fails, wait a day or two and try again.
  5. Never delete this TXT record, now or when DNS moves. Search Console re-checks it and you lose verification without it. If DNS moves to Vercel later, copy it over with every other record.

Check the record yourself

Use Google's web tool, Admin Toolbox Dig⁠ (external site) (TXT tab, look for google-site-verification=), or a command:

Terminal
dig TXT example.com +short
# DNS on Vercel: ask Vercel's nameserver directly
dig TXT example.com +short @ns1.vercel-dns.com

Sources: Vercel⁠ (external site), Resolve-DnsName⁠ (external site) (checked 2026-12). Records Vercel serves can take up to 24 hours to appear elsewhere.

After launch

  • : Indexing → Sitemaps → enter sitemap.xml → Submit (labels Not yet confirmed).
  • URL Inspection: paste a page address into the search bar at the top. Test live URL checks the page as it is now; Request indexing asks Google to crawl it again (labels Not yet confirmed).
  • Search generative AI: Settings → Search generative AI controls whether the site appears in AI Overviews, AI Mode and generative features in Discover. The options are Include (the default), Exclude and Inherit control from parent. Google says it isn't used as a ranking signal for regular Search. Leave it on Include unless the business decides otherwise. (Google⁠ (external site), checked 2026-12)
  • The Performance report has a Generative AI view with impressions only (no clicks or queries). (Google⁠ (external site), checked 2026-12)

If the old site already had a URL-prefix property in Search Console, keep it alongside the new Domain property; its history stays there.

GA4 and Search Console

GA4 Admin → Product links → Search Console links → Link. You need Editor in GA4 and must be a verified owner of the Search Console property (step 2). One Search Console property links to one web stream. A link can't be edited, only deleted and created again. Then open GA4's Library and publish the Search Console report collection, which is hidden by default. (Google⁠ (external site), checked 2026-12)

GA4 and Google Ads (if the business runs Ads)

GA4 Admin → Product links → Google Ads links → Link → choose the Ads account → Confirm → Next. Personalized advertising is on by default. Expand Enable auto-tagging and turn it on, or leave the current setting if the Ads account already handles it → Next → Submit. You need Administrator or Editor in GA4 and Admin in Google Ads. (Google⁠ (external site), checked 2026-12)

After linking, check Admin → Key events (path: check in the UI): on a lead-generation site, only lead events such as generate_lead should be marked. Whether linking marks any events by itself is Not yet confirmed.

Counting leads in Google Ads

  • Simple default: import the GA4 key event generate_lead into Google Ads as a conversion. Only key events can be imported. Imported conversions may start as secondary (Not yet confirmed); make the lead conversion primary if Ads should bid on it.
  • Ads conversion tag: if you gave wp2next an Ads conversion ID and label, the container already holds a Google Ads conversion tag. Google suggests this route (with enhanced conversions) when you need Ads-specific features or don't use GA4.
  • Count each lead once. Make either the imported GA4 key event or the Ads tag the primary conversion, never both.

Sources: Google Ads⁠ (external site), GA4⁠ (external site) (checked 2026-12). How to create the Ads conversion actions is in Tracking and search.

10. Bing Webmaster Tools

  1. Go to bing.com, webmasters⁠ (external site) and sign in.
  2. Choose Import (from Google Search Console) on My Sites or Add a site.
  3. Sign in with the Google account that has the Search Console property → Allow → pick the site → Import.

This verifies the site and brings in its sitemaps, not Search Console's data. re-checks through the Search Console connection; if you remove that access later, verify again with a DNS record or meta tag. Labels are Not yet confirmed (Microsoft's announcement is from 2019: Bing⁠ (external site)).

11. Check it works after launch

  • GA4 Realtime (Reports → Realtime, path Not yet confirmed): open the live site from a network that isn't filtered as internal, for example a phone on mobile data, and accept the banner if there is one. Your visit should appear within a minute or two.
  • GA4 : Admin → Data display → DebugView. Tag Assistant sessions appear here automatically. The Seconds stream covers the last 60 seconds, the Minutes stream the last 30 minutes. (Google⁠ (external site), checked 2026-12)
  • Send one real test message through the site's form: one generate_lead should appear.
  • Key events appear in standard reports within about 24 hours. Search Console data takes a few days.
  • Switch the internal-traffic filter from Testing to Active once you've checked it (step 3).

The full launch checklist, for every analytics tool, is in Tracking and search.

If something goes wrong

ProblemLikely causeFix
Nothing in GA4 before launchAnalytics is off on the preview site on purposeWait for go-live (step 7)
No visits in Realtime after launchContainer not published, or your visit is filtered as internalPublish (step 7); test from a phone on mobile data
Import fails or shows an errorThe file was edited by hand, or is from an old versionRun the tracking command again and import the new file
generate_lead counted twiceForm interactions still on, or the lead is counted by both the Ads tag and the imported key eventTurn off Form interactions (step 3); keep one primary conversion (step 9)
Search Console won't verifyThe TXT record isn't visible yet, or was added at the wrong DNS hostCheck it (step 8); wait a day or two; confirm who manages DNS
Can't link GA4 to Search ConsoleYou're a delegated owner, not a verified oneLink while signed in as the verified owner
Menus don't match this pageGoogle moved them (see 2026 changes)Look under Advanced in Tag Manager, or search Google's help for the setting name

More in Troubleshooting.