Skip to content
FunnelGuard

Fix guide by FunnelsGuard

GA4 config firing after the conversion event: how to fix it

TRK-007High impactPartlyBy FunnelGuardPublished Updated
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.

Where the race breaks the conversion
  1. Visitor submits formConversion event is called
  2. Event fires firstGA4 config has not run yet
  3. Fast redirectPage unloads, request cancelled
  4. 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

Conversions recorded vs realExample numbers
Conversions recorded vs real (example)Real leads: 100 conversions; Recorded in GA4 (race present): 68 conversions; Recorded after fix: 99 conversions038771006899Real leadsRecorded in GA4 (race…Recorded after fixconversions

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

Check the order of calls
  1. 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.

  2. Look for the request

    A request to google-analytics.com/g/collect with en=generate_lead (or your event name) should appear. If it is missing, or shows as cancelled, you have the race.

  3. Check the order

    In the page source and Console, confirm the gtag('config', ...) call comes before any gtag('event', ...) call.

  4. Use GA4 DebugView

    In GA4 go to Admin > DebugView and repeat the test. Missing events or events without a session point to this issue.

  5. Slow the connection

    In Network, set throttling to Slow 4G and repeat. The race often only shows on slow loads.

How to fix it

Correct order: library, config, then eventshtml
<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>
Send the event, then redirect once it is sentjavascript
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
});
Fix by platform
  1. 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.

  2. Use tag sequencing

    Open the GA4 event tag > Advanced Settings > Tag Sequencing and tick Fire a tag before, then pick the Google tag.

  3. 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.

Order of calls

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

Confirmation checklist
  • 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

How the race creeps in
  1. Week 1

    Form submits normally, GA4 events arrive.

  2. Week 3

    A speed plugin defers the analytics script.

  3. Week 4

    Event now runs before config on some loads.

  4. Week 8

    Leads in the CRM no longer match GA4 conversions.

How FunnelGuard handles this

Toggle the raceInteractive
Event fires before config / instant redirect

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.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: missing event caught; cause not named.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.