This tutorial shows how to measure leads — form enquiries, phone calls, WhatsApp clicks and bookings — as key events in Google Analytics 4 (GA4) using Google Tag Manager (GTM). It is written for marketers and developers working together on a business website.
Before you start: you need edit access to the website (or a developer), publish access to a GTM container, and Editor access to the GA4 property.
Step 1: Define what a lead is
List the actions that represent genuine business interest and agree names for them. For example:
| Action | Event name | Useful parameters |
|---|---|---|
| Contact or project form sent successfully | generate_lead | form_name, service, page_location |
| Click on a phone number | click_to_call | link_url, page_location |
| Click on a WhatsApp link | click_to_whatsapp | page_location |
| Booking confirmed | book_appointment | service |
| Form started | form_start | form_name |
generate_lead is one of GA4's recommended event names. Using recommended names where they fit makes reports easier to understand and compatible with future features.
Step 2: Push an event to the data layer on success
The most reliable way to track a form is to fire an event only after the server confirms the submission. Ask your developer to add a data layer push on the success state — for example on the thank-you message or after a successful AJAX response:
window.dataLayer = window.dataLayer || []; dataLayer.push({ event: 'generate_lead', form_name: 'contact', service: 'cloud-solutions' });
Never include personal information such as names, email addresses or phone numbers in the data layer values sent to analytics.
DigiModeler's WordPress theme, for example, pushes generate_lead when an enquiry is saved, form_start when a visitor begins a form, and cta_click for important buttons, so these events are ready to use in GTM.
Step 3: Install Google Tag Manager and the Google tag
- Create a GTM container for the website and add the container snippet to every page (or set the container ID in your theme or plugin settings).
- In GTM, create a Google tag with your GA4 measurement ID (starting
G-) and trigger it on Initialization – All Pages (or All Pages). - Avoid installing GA4 twice — for example once in GTM and again with a plugin — as this double-counts data.
Step 4: Create the trigger and the GA4 event tag
- Variables: create Data Layer Variables for
form_nameandservice. - Trigger: create a Custom Event trigger with the event name
generate_lead. - Tag: create a Google Analytics: GA4 Event tag with the settings below.
- Measurement ID: your
G-ID (or reference the Google tag). - Event name:
generate_lead. - Event parameters:
form_name→{{DLV - form_name}},service→{{DLV - service}}. - Trigger: the custom event trigger from the previous step.
For phone and WhatsApp clicks, use Click – Just Links triggers with conditions such as Click URL starts with tel: or Click URL contains wa.me.
Step 5: Handle consent
In many regions — including the UK and European Economic Area — analytics and advertising cookies require consent. Google's consent mode lets tags adjust their behaviour according to the visitor's choices. Configure your consent banner or consent management platform to set default consent states before tags fire and update them when the visitor chooses. Legal requirements vary by country; check with your adviser which consent model applies to you.
Step 6: Test before publishing
- Use GTM Preview mode (Tag Assistant) and submit a test enquiry.
- Confirm the
generate_leadcustom event appears and your GA4 event tag fired once. - In GA4, open Admin → DebugView and check the event and its parameters arrive.
- Test failure cases: a form with validation errors should not send
generate_lead. - Publish the GTM container with a clear version name.
Step 7: Mark the event as a key event in GA4
After the event has been received, go to Admin → Events (or Admin → Key events) and mark generate_lead as a key event. GA4 renamed "conversions" to "key events" in 2024. Key events then appear in acquisition and engagement reports.
If you register custom parameters such as service as custom dimensions (Admin → Custom definitions), you can report leads by service.
Step 8: Use key events in Google Ads
If you run Google Ads, link the GA4 property to your Google Ads account and import the key event as a conversion — or use a Google Ads conversion tag in GTM. Choose one primary source for bidding to avoid counting the same lead twice.
Step 9: Report on what matters
- Leads by channel, campaign and landing page.
- Lead rate (key events ÷ sessions) by page template.
- Leads by service and country, using custom dimensions.
- Trends after website or campaign changes.
Compare GA4 numbers with your CRM regularly. Differences are normal; large unexplained gaps usually indicate tracking or spam problems.
Common mistakes
- Tracking button clicks instead of successful submissions.
- Sending personal data to analytics.
- Installing GA4 in two places, doubling every event.
- Forgetting consent configuration.
- Marking too many events as key events, which dilutes reporting.
- Never re-testing after website changes.
Need help?
DigiModeler's digital marketing team sets up GA4, Google Tag Manager, consent and lead reporting, and connects them to CRM systems. See also our page on digital marketing in Indore and the technical SEO guide.