If you build websites for local service businesses, there is a good chance the client is paying for Google Ads. HVAC companies, plumbers, law firms and dentists all spend real money on clicks, and the first question they ask after launch is simple: which of these clicks turned into a phone call or a form submission?
If the site cannot answer that, the ad account is flying blind. Google's bidding systems optimize toward whatever you tell them is a conversion. If nothing is tracked, they optimize toward clicks, and clicks are not customers.
This article walks through a clean way to track the two actions that matter most for a local business site, click-to-call taps and lead form submissions, in a Next.js App Router project. It uses the Google tag (gtag.js) directly, keeps the tracking code in one small module, and avoids the common mistakes that cause double counting or missing data.
What we are going to track
For most local service sites there are only a few conversion actions worth sending to Google Ads:
- A tap on a tel: link, usually in the header, the hero section and a sticky mobile bar.
- A successful lead form submission, counted only after the server confirms it.
- Optionally, a click on a booking link if the business uses an external scheduler.
Everything else, such as scroll depth or time on page, belongs in analytics, not in the conversion column of an ad account. Keeping the conversion list short makes the bidding signal cleaner.
In Google Ads you create one conversion action per item above. Each one gives you a conversion ID (it looks like AW-123456789) and a conversion label (a short random string). You will need both.
Step 1: Load the Google tag once
In the App Router, the root layout is the right place to load the tag. Next.js ships a Script component that handles loading order for you.
// app/layout.tsx import Script from "next/script"; const ADS_ID = process.env.NEXT_PUBLIC_GOOGLE_ADS_ID; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <body> {children} {ADS_ID && ( <> <Script src={`https://www.googletagmanager.com/gtag/js?id=${ADS_ID}`} strategy="afterInteractive" /> <Script id="gtag-init" strategy="afterInteractive"> {` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${ADS_ID}'); `} </Script> </> )} </body> </html> ); } A few notes on this:
- The ID comes from an environment variable, so preview deployments can run without it and you do not pollute the client's data while testing.
- The afterInteractive strategy loads the tag after hydration. It does not block the first paint, which matters for Core Web Vitals and for the landing page experience score inside Google Ads.
- The tag is loaded once for the whole app. Do not add it again inside individual pages.
Step 2: Put all tracking calls in one module
Scattering gtag calls across components makes them hard to audit later. A tiny helper module keeps everything in one place.
// lib/conversions.ts type GtagFn = (...args: unknown[]) => void; declare global { interface Window { gtag?: GtagFn; } } const ADS_ID = process.env.NEXT_PUBLIC_GOOGLE_ADS_ID; const LABELS = { call: process.env.NEXT_PUBLIC_ADS_LABEL_CALL, lead: process.env.NEXT_PUBLIC_ADS_LABEL_LEAD, }; export function trackConversion(kind: keyof typeof LABELS, value?: number) { const label = LABELS[kind]; if (typeof window === "undefined" || !window.gtag || !ADS_ID || !label) return; window.gtag("event", "conversion", { send_to: `${ADS_ID}/${label}`, ...(value ? { value, currency: "USD" } : {}), }); } The function quietly does nothing when the tag is missing. That is intentional. An ad blocker, a missing environment variable or a server render should never break the button the visitor just tapped.
Step 3: A call button that reports the tap
Phone calls are usually the most valuable action on a local service site. Someone with a broken air conditioner in July is not going to fill out a long form. They are going to tap the number.
// components/CallButton.tsx "use client"; import { trackConversion } from "@/lib/conversions"; export function CallButton({ phone, label }: { phone: string; label: string }) { const href = `tel:${phone.replace(/[^0-9+]/g, "")}`; return ( <a href={href} onClick={() => trackConversion("call")} className="btn-primary"> {label} </a> ); } Because the link opens the phone dialer and the page stays loaded, the gtag call has time to fire. You do not need to delay navigation or add a timeout.
Use this one component everywhere the number appears: header, hero, sticky bar and footer. If one location uses a plain anchor tag instead, those taps simply disappear from your reports, and nobody notices for months.
A tap is not the same as a completed call, of course. Google Ads can also track calls from ads directly and calls through a forwarding number, but those need setup inside the ad account. Tracking taps on the site is the baseline that every project should have on day one.
Step 4: Count a form submission only after it succeeds
The most common mistake with form tracking is firing the conversion on the submit click. If validation fails, the network drops or the server returns an error, you have still told Google that a lead happened. Over time the account learns to chase visitors who click submit and then leave.
Fire the conversion only after the server confirms the lead was saved.
// components/LeadForm.tsx "use client"; import { useState } from "react"; import { trackConversion } from "@/lib/conversions"; export function LeadForm() { const [status, setStatus] = useState<"idle" | "sending" | "done" | "error">("idle"); async function onSubmit(e: React.FormEvent<HTMLFormElement>) { e.preventDefault(); setStatus("sending"); const data = Object.fromEntries(new FormData(e.currentTarget)); const res = await fetch("/api/lead", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); if (res.ok) { trackConversion("lead"); setStatus("done"); } else { setStatus("error"); } } if (status === "done") return <p>Thanks. We will get back to you shortly.</p>; return ( <form onSubmit={onSubmit}> <input name="name" required placeholder="Your name" /> <input name="phone" type="tel" required placeholder="Phone number" /> <textarea name="message" placeholder="How can we help?" /> <button disabled={status === "sending"}> {status === "sending" ? "Sending..." : "Request a quote"} </button> {status === "error" && <p>Something went wrong. Please call us instead.</p>} </form> ); } Two details make this reliable. The button is disabled while sending, so a double click does not create two conversions. And the conversion fires in the success branch only, so the number in the ad account matches the number of leads in the client's inbox.
If you use a Server Action instead of an API route, the pattern is the same. Await the action, check the result, then call trackConversion on the client.
Step 5: Avoid double counting on thank you pages
Some setups redirect to a /thank-you page and fire the conversion there. That works, but it creates two problems. Visitors can bookmark or refresh the page, and if you also fire on the form success, every lead counts twice.
Pick one approach. Firing in the success handler, as shown above, is simpler with client side forms. If you prefer a thank you page, fire the conversion there only and set the conversion action in Google Ads to count "One" per click rather than "Every". That setting is the right default for lead generation anyway, since one person submitting the form twice is still one lead.
Step 6: Respect consent where it applies
If the business serves visitors in regions with consent rules, Google's Consent Mode lets you set a default state before the tag loads and update it after the visitor chooses. Add a default consent call before the config line in the init script and update it from your cookie banner. For many US local businesses a banner is not legally required everywhere, but the client should make that decision with proper advice, and your code should make it easy to switch on.
Step 7: Test it before the client spends anything
Before you hand the site over, verify every conversion path:
- Install the Google Tag Assistant browser extension or use the preview mode linked from the ad account, then tap each phone link and submit the form with real test data.
- Confirm the conversion event appears with the correct send_to value.
- Submit the form with a forced server error and confirm no conversion fires.
- Check the production build, not just the dev server. Environment variables prefixed with NEXT_PUBLIC are inlined at build time, so a missing variable in your hosting dashboard means the tag silently does nothing.
Inside Google Ads, the conversion action status moves from "Unverified" to "Recording conversions" once real data arrives. Give it a day before assuming something is wrong.
Why this matters for the landing page itself
Tracking only tells you what happened. It does not make the page convert. In our work on Google Ads management for local service businesses, the biggest wins usually come from fixing the page first: a phone number that is visible without scrolling, a short form, and a headline that matches the search. Our HVAC Google Ads page goes into what that looks like for heating and cooling companies specifically.
It also helps to show the client what an unanswered call costs. Once tracking is live, the call tap numbers make that conversation concrete. We wrote a plain explanation of the cost of missed calls for a local business that is useful to share with non technical owners.
Wrapping up
The whole setup is small: one script tag in the root layout, one helper module, one call button component and one form that reports success honestly. That is enough to give an ad account the signal it needs, and enough to give the business owner a straight answer about what their ad spend is producing.
If you are building on Next.js for local businesses and want a second pair of eyes on the stack, our Next.js development team works on exactly these kinds of sites.
CodeHunterz Team

