On this page
What this issue is
GA4 needs two things before it can record a conversion: the library (gtag.js) loaded, and a config command that sets up the measurement ID. If your code sends an event such as generate_lead or purchase before config has run, the event can be lost or arrive without the session and client details that tie it to a visit.
- Visitor submits formConversion event is called
- Event fires firstGA4 config has not run yet
- Fast redirectPage unloads, request cancelled
- Thank-you pageNo conversion in GA4
The event is queued before config, then the redirect cancels the request.
Why it costs you leads or sales
Example: 100 real leads in a week, with GA4 recording fewer when the race is lost on slower connections.
How to check if your site has it
Open DevTools Network tab
In Chrome press F12, open Network, tick Preserve log and filter by
collect. Submit your form or run a test purchase.Look for the request
A request to
google-analytics.com/g/collectwithen=generate_lead(or your event name) should appear. If it is missing, or shows as cancelled, you have the race.Check the order
In the page source and Console, confirm the
gtag('config', ...)call comes before anygtag('event', ...)call.Use GA4 DebugView
In GA4 go to Admin > DebugView and repeat the test. Missing events or events without a session point to this issue.
Slow the connection
In Network, set throttling to Slow 4G and repeat. The race often only shows on slow loads.
How to fix it
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>form.addEventListener('submit', function (e) {
e.preventDefault();
var done = false;
function go() { if (!done) { done = true; form.submit(); } }
gtag('event', 'generate_lead', {
event_callback: go,
transport_type: 'beacon'
});
setTimeout(go, 1000); // safety net if the callback never runs
});Fire config first
Make sure your Google tag (GA4 configuration) uses the All Pages trigger, or Initialization - All Pages, so it runs before event tags.
Use tag sequencing
Open the GA4 event tag > Advanced Settings > Tag Sequencing and tick Fire a tag before, then pick the Google tag.
Avoid slow triggers
If the event fires on a link click that leaves the page, enable Wait for Tags on the trigger (Click triggers) with a short delay such as 2000 ms.
Find the duplicate loaders
Check your analytics plugin, theme settings and any header-code plugin to see where GA4 loads. Keep one source.
Load config in the head
Put the gtag snippet in the head, not the footer, so it runs before form or checkout scripts.
Fix the thank-you redirect
If your form plugin redirects instantly, use its option to show a confirmation page, or fire the event on the thank-you page instead.
Use the Google & YouTube app or Customer events
Prefer Shopify's built-in connection or a Custom pixel under Settings > Customer events, which handles the order of calls on checkout.
Avoid manual theme edits for purchase
Purchase events placed in theme code do not run on the checkout pages in the same way. Use the pixel instead.
Place config in Head code
Add the gtag snippet in Site settings > Custom code > Head code.
Fire the event on the thank-you page
If Webflow redirects after a form, put the event in that page's Before </body> code, after config has loaded.
Queue through dataLayer
gtag pushes to dataLayer, so events called after the snippet are queued correctly. Make sure the snippet is above any event call.
Use event_callback or beacon
Delay navigation until the callback runs, or use transport_type beacon, as shown in the code above.
Before
- Event runs before config
- Redirect fires instantly on submit
- Request cancelled, conversion missing
After
- Config loads in the head
- Event sent with a callback or beacon
- Redirect waits for the hit
How to confirm it's fixed
- The collect request for your event shows status 200 or 204, not cancelled
- DebugView shows the event with page_view and session_start before it
- The test works on Slow 4G throttling too
- The event appears once, not twice
- The conversion shows in GA4 Reports > Realtime within a minute or so
- Repeat on mobile as well as desktop
How to prevent it happening again
Week 1
Form submits normally, GA4 events arrive.
Week 3
A speed plugin defers the analytics script.
Week 4
Event now runs before config on some loads.
Week 8
Leads in the CRM no longer match GA4 conversions.
How FunnelGuard handles this
Race present
Leads or data lost
The collect request is cancelled or lacks session data, and the conversion is missing in GA4.
Turn the cause on to see the conversion disappear.
Questions people ask
Why is my GA4 conversion event not showing up after a form redirect?
The page probably redirects before the browser sends the GA4 hit, so the request is cancelled. It can also be that the event ran before the config command. Use an event callback or beacon transport, or fire the event on the thank-you page.
Does the GA4 config have to come before events?
Yes. The config command sets up the measurement ID and session details. Events sent before it can be lost or arrive without session data, so place the gtag snippet with config above any event calls.
How do I make GA4 wait for the event before redirecting?
Pass an event_callback to gtag('event', ...) and redirect inside it, with a timeout of about one second as a safety net. You can also set transport_type: 'beacon' so the browser sends the request as the page unloads.
How do I fix the order of tags in Google Tag Manager?
Fire the Google tag on Initialization - All Pages, or set Tag Sequencing on your event tag so the Google tag fires first. For link clicks that leave the page, enable Wait for Tags on the trigger.
How can I tell if GA4 is losing conversions to a race condition?
Submit a test conversion with the Network tab open and filter by collect. If the request is cancelled or missing, or DebugView shows no event, you likely have the race. Repeat with Slow 4G throttling, as slow loads make it more likely.
Can FunnelGuard find the cause of a GA4 event firing before config?
Only partly. FunnelGuard catches the missing GA4 event during a scheduled journey and alerts you, but it does not name the cause. You need to check script order and redirects by hand.
Is firing the conversion on the thank-you page safer?
Usually yes. By then config has loaded and the page is not about to unload. Add a guard so a refresh or back-button visit does not count the conversion twice.
Related issues
- TRK-001GA4 tag missing from a funnel pageFix guide
- TRK-006GA4 installed twice (gtag.js and GTM) causing double page_viewsFix guide
- TRK-008gtag.js loaded but config command never calledFix guide
- TRK-012GA4 missing on thank-you or order confirmation pageFix guide
- TRK-013GA4 missing on hosted checkout or booking domainFix guide
- TRK-009GA4 script blocked by Content Security PolicyFix guide