Sub topic 5
Designing the lead event
This chapter assumes you have a GA4 property with a web data stream, Editor access, and basic familiarity with Reports and Admin. You should also know how a website form submission works. Earlier chapters covered the event and parameter model and the difference between automatic, recommended, and custom events. This chapter applies that model to one decision: how to design the event that represents a lead.
What the lead event has to do
A lead event is the signal that a visitor has done something that has value to the business, short of buying. Typical examples are a contact form, a quote request, a newsletter signup, a demo booking, or a click-to-call.
The event has to meet four requirements:
- It fires only when the lead is real, not when someone merely views or starts a form.
- It has a name that reporting, Google Ads, and audiences can all use consistently.
- It carries enough parameters to tell leads apart when you analyze them.
- It can be marked as a key event without producing inflated or misleading counts.
Getting the design right before you write code matters. Changing an event name later splits your history into two separate events. Key event status is also not applied retroactively to data collected before you marked the event.
Choosing between generate_lead and a custom event
GA4 has a recommended event named generate_lead. Recommended events have names and parameters defined by Google, so GA4 can attach built-in meaning to them. Using one costs you nothing and keeps your property consistent with Google's documentation.
Use generate_lead when the action is a lead in the ordinary sense. Use a custom event when you need to separate lead types that have different business meaning and different values.
| Situation | Recommended choice | Reason |
|---|---|---|
| One main contact or quote form | `generate_lead` | Standard name, no extra design work |
| Several forms of equal importance | `generate_lead` plus a parameter such as `form_id` | One key event, filterable by form |
| Forms with very different value, such as a demo request versus a newsletter signup | `generate_lead` for the high-value one, a custom event for the other | Only the high-value event becomes a key event |
| A phone call or chat start | Custom event such as `click_to_call` | `generate_lead` does not describe the action |
A common mistake is to create one key event per form. That makes the key event list long and hard to compare. Prefer one generate_lead event with a distinguishing parameter, unless the forms genuinely represent different outcomes.
Deciding when the event fires
The most important design choice is the moment the event fires. There are several candidate moments, and they differ in accuracy.
- Form view. The visitor sees the form. This is not a lead.
- Form start. The visitor types in the first field. This is interest, not a lead.
- Submit click. The visitor clicks the button. Validation may still reject the form, so this overcounts.
- Successful submission. The server accepts the data. This is the correct moment.
- Confirmation page view. A thank-you page loads. This is also acceptable if the page cannot be reached any other way.
Fire the event on the successful result, either from a success callback in your form code or from the confirmation page. Avoid firing on the click.
Thank-you pages have a weakness. A visitor who reloads the page, bookmarks it, or returns through the browser history fires the event again. If you use a thank-you page, make sure the event fires only on a real submission. For example, check a one-time flag, or have the server redirect only after a successful post.
Sending the event
The event is sent with gtag.js or through Google Tag Manager. Both produce the same event in GA4. This section uses gtag.js, and the next chapters cover the options in more detail.
// Fire after a lead form is successfully submitted
gtag('event', 'generate_lead', {
currency: 'USD',
value: 25.00
});This sends the recommended event with an estimated lead value. The value and currency parameters are covered in more depth later. Two rules apply now:
- If you send
value, you must also sendcurrency, using a three-letter ISO 4217 code such asUSDorEUR. Without it, GA4 does not treat the value as revenue. - The value is your estimate of what a lead is worth, not a payment. Section "Estimating a lead value" below explains how to choose it.
To make leads analyzable, add parameters that describe the lead. Here is a fuller example that fires from a form's success handler.
function onLeadFormSuccess(formId, leadType) {
gtag('event', 'generate_lead', {
currency: 'USD',
value: 25.00,
form_id: formId,
lead_type: leadType
});
}
// Example call after the server confirms the submission
onLeadFormSuccess('contact_main', 'quote_request');Here form_id and lead_type are custom parameters. A custom parameter is not available in reports until you register it as a custom dimension in Admin. Until then the data is collected, but you cannot break reports down by it. Registering is not retroactive either, so do it at launch.
Keeping personal data out of the event
Never put an email address, name, phone number, or any other personal data into an event parameter. Google's terms prohibit sending personally identifiable information to Google Analytics, and the data is hard to remove once collected.
This applies to all the parameters above. form_id and lead_type are safe because they describe the form, not the person. A parameter such as email is not safe. Be careful also with page URLs: if a form submits by GET, the address may appear in the URL, which GA4 records as page_location. Switch the form to POST or redirect to a clean URL.
Estimating a lead value
A lead has no price at the moment it is created. A value is useful because it lets you compare lead sources with sales on one scale and supports value-based bidding in Google Ads. A reasonable method:
- Take the average revenue from a closed customer.
- Multiply it by the share of leads that become customers.
- Use the result as the value of one lead.
For example, if an average customer pays 500 USD and 5 percent of leads close, the expected value of a lead is 25 USD. That is the figure used in the earlier code.
If you cannot estimate it, leave value out. A made-up value distorts revenue reports and bidding more than no value does. If leads differ a lot in worth, set the value per lead type, for instance 50 for a demo request and 5 for a newsletter signup.
Marking the event as a key event
Once generate_lead appears in GA4, you can mark it as a key event. The event must have been received at least once before it appears in the list. In Admin, open Events and switch on Mark as key event for generate_lead. If the event does not appear yet, trigger it and wait. You can also use Key events and select New key event to type the name in advance.
Only mark events that represent a real business outcome. Marking page_view or scroll as key events fills your reports with noise and corrupts conversion rates.
Choosing the counting method
For a lead, think about whether one person submitting twice in a session is two leads. GA4 offers two counting methods: once per event and once per session. This chapter gives only the lead guidance, and a later chapter covers the setting in full.
- Once per event counts every occurrence. Use it when each submission is a separate lead, such as a support or quote request.
- Once per session counts at most one per session. Use it when repeats are likely and do not add value, such as a newsletter signup that people retry.
For most lead forms, once per session gives a count that matches how the business thinks about leads. The setting applies from the time you change it, not to past data.
Verifying the design
Test before relying on the data. Open DebugView by enabling debug mode, submit the form, and check these points:
- The event name is exactly
generate_lead. valueis a number, andcurrencyis present.- The event fires once per submission, not twice.
- A failed submission, such as one with a missing required field, does not fire the event.
- No parameter contains personal data.
Common design mistakes
| Mistake | Effect | Fix |
|---|---|---|
| Firing on submit click | Counts failed submissions | Fire on the success response |
| Firing on a reloadable thank-you page | Duplicate leads | Guard with a flag or server redirect |
| Sending `value` without `currency` | Value ignored in revenue | Always send both |
| Inventing a value | Misleading revenue and bidding | Estimate from close rate, or omit |
| One key event per form | Cluttered, hard-to-compare data | One event plus a `form_id` parameter |
| Personal data in parameters | Policy violation | Send only non-identifying descriptors |
Exercise
A site has a contact form that shows validation errors on the page and, on success, redirects to /thanks. An analyst fires generate_lead when the submit button is clicked, and the lead count is 30 percent above the number of emails the sales team receives. Explain the likely cause and give a better design, including how to treat a visitor who reloads /thanks.
Show answer
The click fires the event even when validation fails, so rejected submissions are counted as leads. Fire generate_lead only on successful submission, either from the form's success handler or on /thanks. For /thanks, make sure it is reached only after a successful post, and guard against reloads with a one-time flag (for example stored in sessionStorage) or a server-side redirect, so a refresh or bookmark does not fire the event again. Then confirm in DebugView that a failed submission fires nothing and a successful one fires once.
Exercise
Your business closes 4 percent of leads, and an average customer pays 750 USD. Write the gtag call for a generatelead event with an appropriate value and a formid of "quote_form".
Show answer
The expected lead value is 750 x 0.04 = 30 USD. gtag('event', 'generatelead', { currency: 'USD', value: 30.00, formid: 'quoteform' }); The currency must accompany the value, and formid is a custom parameter that needs a custom dimension before it can be used in reports.