Google Tag Manager & Analytics 4 Setup for Lead-Gen Tracking
Google Tag Manager & Analytics 4 Setup for Lead-Gen Tracking
Your Google Ads account is open and your Google Business Profile is optimized. Now we need to install the tracking foundation: Google Tag Manager and Google Analytics 4.
This is the most technical setup in the entire guide, but it’s absolutely critical. Without proper tracking, you’re flying blind—you won’t know which keywords drive customers, what happens on your website after people click, or how to optimize for better results.
Here’s why Google Tag Manager is so important, even though it’s not technically required: GTM is a safe place to put all your marketing codes and tags. Whether you’re working with an agency or have in-house marketing people, you can give them access to GTM and they can implement tracking codes without ever touching your website’s core code. This is huge for reducing risk.
I’ve seen too many situations where adding a tracking code directly to a website broke something—the checkout process stopped working, a form disappeared, the site layout shifted. With GTM, marketing people work in a contained environment. They can add tags, test them, and troubleshoot when events fire, all without disturbing your website code.
It’s also worth noting that GA4 has an event-based tracking system, which is a different mentality than the old Google Analytics Universal. GTM makes managing these events much easier.
Let’s get it set up correctly from the start.
Why Install GTM First, Then GA4
The old way of tracking was messy. You’d add Google Analytics code directly to your website. Then you’d add Google Ads conversion tracking code. Then Facebook pixel code. Then call tracking code. Pretty soon, you had a dozen tracking scripts scattered across your site, and every time you needed to change something, you needed a developer to edit the code.
Google Tag Manager changes this completely. GTM is a container that manages all your tracking codes. You install GTM once on your website—two small code snippets—and from that point forward, you manage everything through the GTM dashboard. No more touching website code. No more waiting for developers. No more accidentally breaking things.
If you have GTM installed first, you don’t need to put much, if anything, directly inside your website code. There’s less that can go wrong. It’s also better to avoid duplicate tracking codes in multiple places—if you have GA4 installed both directly on your site AND through GTM, you’ll get duplicate data and your reports will be worthless.
Here’s how it works: GTM is the foundation. GA4 goes inside GTM as a tag. Your Google Ads conversion tracking goes inside GTM as tags. Your call tracking code goes inside GTM. Everything is managed from one central dashboard.
GA4’s job is to track what happens after someone clicks your ad and lands on your website. Where do they go? What pages do they visit? How long do they stay? Do they submit a form or call you? GA4 captures all of this behavior and sends it back to Google Ads, which uses that data to optimize your campaigns.
Install GTM first. Then add GA4 inside it. That’s the right order.
Installing Google Tag Manager
Let’s start with the foundation. Go to tagmanager.google.com and sign in with your Google account (use the same one you used for Google Ads).
Click “Create Account” and enter your business name as the account name. Then create a container—this is typically your website URL. Choose “Web” as the platform (unless you’re tracking a mobile app, which is different).
GTM will give you two code snippets. This is what you need to install on your website.
Snippet 1 goes in the <head> section of every page on your website—as high up in the head as possible. Snippet 2 goes immediately after the opening <body> tag of every page. Both snippets need to be on every single page of your website, not just the homepage.
How you install these depends on your website platform:
If you’re using WordPress, use a plugin like “Google Tag Manager for WordPress” by Thomas Geiger or “GTM4WP” by DuracellTomi. Install the plugin, paste your GTM container ID (it looks like GTM-XXXXXXX), and the plugin handles the rest. This is the easiest method and I recommend it for WordPress sites.
If you’re using Shopify, Wix, or Squarespace, these platforms have built-in settings for Google Tag Manager. Go to your settings, find the section for custom code or integrations, and paste your GTM container ID. The platform automatically places the code in the right location.
If you have a custom-built website, you’ll need a developer to add the code snippets to your site’s template or theme files. Make sure they add both snippets to every page template—homepage, service pages, contact page, blog posts, everything.
Verify the installation by using GTM’s Preview Mode. In your GTM dashboard, click “Preview” in the top right. This opens a new tab where you can enter your website URL. Visit your website and GTM will show you a debug panel at the bottom of the screen. If it says “Connected” and shows your page activity, GTM is installed correctly.
Common installation issues:
The most common problem is GTM being installed on some pages but not all. The code needs to be on every single page. Test multiple pages—homepage, a service page, your contact page—to verify.
Another issue is code placement. The first snippet needs to be in the <head>, and the second needs to be right after <body>. If they’re in the wrong spots, GTM may not work properly.
Finally, avoid installing multiple GTM containers on the same site. This causes conflicts and breaks tracking. One container per website.
Setting Up GA4 Inside GTM
Now that GTM is installed, let’s add Google Analytics 4.
Go to analytics.google.com and sign in. Click “Admin” in the bottom left, then “Create Property.” Choose GA4 (not Universal Analytics—that’s the old version being phased out). Enter your business details and time zone. Make sure your time zone matches what you set in Google Ads.
Once your property is created, go to “Data Streams” under the Data Collection section. Click “Add stream” and select “Web.” Enter your website URL and give the stream a name (usually just your website name).
Copy your Measurement ID. It starts with “G-” followed by a series of numbers and letters (example: G-ABC123XYZ). This is what connects GA4 to your website through GTM.
Now go back to your GTM dashboard. Click “New Tag,” then choose “Google Analytics: GA4 Configuration” as the tag type. Paste your Measurement ID into the field.
For the trigger, select “All Pages.” This means the GA4 tag will fire on every page of your website, tracking every page view.
Save the tag and name it something clear like “GA4 – Configuration.”
Before this goes live, you need to publish your GTM container. Click “Submit” in the top right of GTM, add a version name (like “Added GA4”), and publish. Your GA4 tracking is now live.
Test it immediately. Go back to GA4 and open the “Realtime” report. Visit your website in another tab. Within a few seconds, you should see your visit appear in the Realtime report. If you do, GA4 is working correctly.
Important GA4 Settings
Inside Google Ads, it’s important that you approve all the signals getting passed back from GA4. In GA4, go to Admin → Data Settings → Data Collection. Make sure “Google signals data collection” is turned ON. This allows GA4 to send enhanced conversion data back to Google Ads for better optimization.
Also, increase your data retention from the default 2 months to 14 months. In Admin → Data Settings → Data Retention, change the setting to “14 months.” This gives you more historical data to analyze.
There are other settings you can configure to track properly—enhanced measurement options, cross-domain tracking if you have multiple domains, user properties for segmentation. Discussing this with a tracking expert like Pixelocity is a good idea, as it can help align things properly.
Here’s why getting this right at the beginning matters: Once data is stored, you can’t retroactively fix data problems. If you’re not tracking phone clicks for the first three months, you’ve lost that data forever. Do this correctly now.
What GA4 tracks automatically:
- Page views
- Scroll depth (how far users scroll down pages)
- Outbound clicks (links to other websites)
- File downloads (PDFs, documents)
- Video engagement (YouTube videos embedded on your site)
What you need to set up manually:
- Form submissions
- Phone clicks
- Button clicks
- Chat interactions
- Custom events specific to your business
We’ll cover detailed conversion tracking in Chapter 6, but let’s set up the basics now.
Basic Conversion Tracking Setup
Once Tag Manager is installed, you need to identify the different objectives and goals you want to track. For lead-generation businesses, this typically includes form fills, phone calls, chatbot interactions, and engagement signals like video watching or page scrolling.
These events need to fire in GTM, and then they’re passed back to both GA4 and Google Ads so your campaigns can optimize toward actual conversions.
First, create conversion actions in Google Ads. Go to Tools & Settings → Conversions in your Google Ads account. Click the plus button to create a new conversion action. Choose “Website” as the source.
Create separate conversion actions for:
- Form submissions (contact forms, quote request forms)
- Phone calls (clicks on your phone number)
- Any other key actions (chat opens, video views, etc.)
For each conversion action, Google Ads will give you a Conversion ID and Conversion Label. You’ll need these to set up tracking in GTM.
Tracking Form Fills the Easy Way: Thank You Pages
Here’s the easiest and most reliable way to track form fills: set up Thank You pages in your funnels.
When someone fills out a contact form or quote request, they should land on a Thank You page with a unique URL—something like yoursite.com/thank-you or yoursite.com/quote-submitted. When someone reaches that URL, you know they completed the goal. They went through the funnel successfully.
This is old school, but it still works beautifully because it’s simple and reliable. An event fires when that Thank You page URL loads, and that event is tracked as a conversion in both GTM and Google Ads.
Set up form tracking in GTM using Thank You pages. Create a new tag, choose “Google Ads Conversion Tracking” as the tag type, and paste in your Conversion ID and Label from the form submission conversion action you created.
For the trigger, select “Page View” and specify the Thank You page URL. For example, if your Thank You page is yoursite.com/thank-you, the trigger fires whenever someone lands on that URL. That’s your conversion.
This method is more reliable than trying to track form submissions directly, because forms can be tricky—Ajax forms, multi-step forms, forms that reload the page. Thank You pages eliminate all that complexity. Someone lands on the Thank You page = they submitted the form.
Set up phone click tracking. Create another new tag for Google Ads Conversion Tracking, paste in the Conversion ID and Label for phone calls. For the trigger, create a new trigger that fires when someone clicks on a phone number link (these are usually formatted as tel: links).
Test both of these. Submit a test form and verify you land on the Thank You page—check that the conversion appears in Google Ads. Click your phone number and verify that conversion fires too.
Primary vs. Secondary Conversions
It’s important to have conversions and goals set up properly so you can track which ones are primary and which are secondary in importance.
Primary conversions are the actions that directly lead to revenue: form submissions requesting quotes, phone calls to your business, scheduled appointments. These are what you optimize your campaigns toward.
Secondary conversions are engagement signals that indicate interest but don’t directly generate leads: video views, PDF downloads, time on site, page scrolls. These are useful for understanding user behavior, but you don’t want Google optimizing your bids to maximize PDF downloads—you want actual leads.
In Google Ads, when you create conversion actions, you can designate which are “Primary” and which are “Secondary.” Make sure form fills and phone calls are marked as Primary. This tells Google’s automated bidding to optimize toward those actions, not secondary engagement metrics.
Why do this before launching campaigns? Because conversion data feeds Google’s automated bidding strategies. If you launch campaigns without conversion tracking, Google optimizes for clicks, not results. That’s expensive and ineffective. Historical conversion data helps campaigns learn faster, so get this set up now.
Detailed conversion tracking—including call tracking platforms that give you unique phone numbers for each campaign—is covered in Chapter 6. For now, basic phone click and form tracking with Thank You pages gets you started.
Linking GA4 to Google Ads
Your GA4 property and Google Ads account need to be linked so data flows between them.
In GA4, go to Admin → Google Ads Links. Click “Link” and select your Google Ads account from the list. Enable auto-tagging (this appends tracking parameters to your URLs so GA4 knows which clicks came from which ads).
You can also choose to import GA4 conversions into Google Ads. This is optional—some businesses prefer to use only Google Ads conversion tracking, others import GA4 goals as additional conversion actions. Your choice.
What linking enables:
You can see event data and engagement metrics in your Google Ads reports. Google Ads doesn’t show you traditional analytics metrics like bounce rate, pages per session, or time on site anymore. Instead, it focuses on events that are being fired and engagement metrics—form submissions, phone clicks, video views, scroll depth, and other conversion actions you’ve set up.
You can build remarketing audiences in GA4 based on user behavior—like “people who visited the pricing page but didn’t convert” or “people who watched a video but didn’t fill out a form”—and use those audiences in Google Ads campaigns for retargeting.
It’s also helpful to have Google Analytics set up with segments and audiences that can be used for different campaign strategies. You can create audiences based on specific behaviors and engagement patterns, then target them with tailored ads.
Verify the connection by going to Google Ads → Tools & Settings → Linked Accounts. You should see GA4 listed as connected. Run a test conversion and verify it appears in both GA4 and Google Ads.
Testing Everything and Avoiding Common Mistakes
Before you launch any campaigns, test everything twice.
Submit a test form on your website. Did you land on the Thank You page? Did the conversion appear in Google Ads? Click your phone number. Did that conversion fire? Use GTM Preview Mode to watch tags fire in real-time. Check GA4’s Realtime report to verify visits are being tracked.
Run Google Ads Tag Assistant (a free Chrome extension) to verify all your Google tags are installed and firing correctly.
Don’t skip testing. Launching campaigns with broken tracking means wasted budget. You’ll spend money without knowing what’s working.
Common mistakes to avoid:
Installing GA4 directly on your site AND through GTM creates duplicate tracking. Pick one method (GTM is better).
Not installing GTM on all pages means you only track some visitor behavior, not all of it.
Enabling auto-tagging in GA4 but not linking the accounts means the data doesn’t flow properly.
Not testing before launch is the biggest mistake. Always test.
Your Tracking Foundation Is Complete
Before moving forward, verify:
☐ GTM installed on all pages
☐ GTM verified with Preview Mode
☐ GA4 property created
☐ GA4 tag added in GTM and firing
☐ GA4 tested in Realtime report
☐ Data retention set to 14 months
☐ Google signals enabled
☐ Conversion actions created in Google Ads (Primary and Secondary)
☐ Thank You pages set up for form tracking
☐ Form and phone tracking configured in GTM
☐ GA4 linked to Google Ads
Your tracking foundation is complete. GTM is managing all your tracking codes, GA4 is capturing visitor behavior and events, and basic conversion tracking is firing. You can now measure what’s working and optimize your campaigns based on real data.
Next, we’ll set up Google Search Console. While it’s outside the scope of paid advertising, Search Console gives you valuable insights into organic search performance and can inform your Google Ads keyword strategy.