Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Server-side tracking endpoint returning 5xx errors: find and fix

TRK-377High impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Server-side tracking means your website or browser sends events to a server you control, such as a server-side Google Tag Manager (sGTM) container, a first-party tracking subdomain or your own API. That server then forwards them to ad and analytics platforms. The endpoint is the URL that receives those events.

A 5xx status code means the server failed, not the visitor. Common ones: 500 (internal error), 502 (bad gateway, the proxy got a bad answer), 503 (unavailable or overloaded) and 504 (timeout). Intermittent means most requests work and some fail, which makes it easy to miss.

Where an intermittent 5xx loses a conversion
  1. Visitor convertsForm sent or order placed
  2. Event sent to your endpointPOST to your server-side URL
  3. Endpoint returns 5xx502, 503 or 504 on some requests
  4. Forwarded to GA4 / Ads / MetaNever happens
  5. Attribution and biddingConversion missing from reports

The browser did everything right, but the server-side step failed, so the platforms never hear about the sale.

Why it costs you leads or sales

The visitor still gets their confirmation, so nothing looks wrong on the site. But each failed request is a conversion the ad platforms never see. Smart bidding then learns from incomplete data, reports undercount, and campaigns can look worse than they are. Because only some requests fail, the gap is easy to blame on ad blockers or consent instead.

Conversions reported vs realExample numbers
Conversions reported vs real (example)Real conversions: 200 conversions per week; Reported in ad platform: 184 conversions per week077153200184Real conversionsReported in ad platfo…conversions per week

Example: 200 real conversions, with 8% of server-side requests failing at peak times.

How to check if your site has it

Find out whether your endpoint is failing
  1. Open browser DevTools

    In Chrome, press F12, open the Network tab and filter by your tracking domain (for example metrics.yourdomain.com). Convert on a test form or page and look for red requests with a 5xx status. Repeat several times, since failures are intermittent.

  2. Check the server logs

    For sGTM on Google Cloud, open Logs Explorer for the Cloud Run or App Engine service and filter by severity ERROR or by httpRequest.status>=500. Note the times and the paths.

  3. Look at the metrics

    In Cloud Run, check the Metrics tab for request count by response code, container instance count, CPU and memory. Spikes in 5xx that line up with high load or instance limits point to capacity.

  4. Test with a quick loop

    Send repeated requests to a health or ping URL and count non-200 answers, as in the snippet below.

Count non-200 responses from your endpointbash
for i in $(seq 1 100); do
  curl -s -o /dev/null -w "%{http_code}\n" https://metrics.example.com/healthz
done | sort | uniq -c

For sGTM, /healthz is the built-in health check path. If your own endpoint has a different path, use that. Replace the domain with yours.

How to fix it

The right fix depends on what the logs show. Match the symptom to the likely cause first.

Common 5xx symptoms and likely causes
StatusLikely causeFirst thing to try
500Error in a tag, client or custom codeRead the stack trace in the logs; fix or disable the tag
502Instance crashed or proxy got an invalid replyCheck memory limits and crashes; review proxy or load balancer
503No free instances, overload or deploy in progressRaise minimum and maximum instances
504Request took too long, often a slow downstream APIRaise timeouts and fix slow destinations
Fix by setup
  1. Raise minimum instances

    If your server container runs on Cloud Run, set the minimum instances to at least 2 (Google recommends more than one for production) and raise the maximum so traffic spikes can scale out.

  2. Check CPU and memory

    If logs show out-of-memory or CPU throttling, increase memory and CPU for the service.

  3. Find failing tags

    In the server container, open Preview and replay a failing request. Look for tags with errors or very slow responses, and fix or pause them.

  4. Publish and test

    Publish the container, then repeat the check loop and confirm the 5xx count drops.

How to confirm it's fixed

Confirmation checklist
  • The curl loop returns only 200 responses over several runs, including at a busy time of day
  • Logs Explorer shows no 5xx for your endpoint over the last 24 hours
  • Instance count scales up under load without errors
  • A test conversion appears in GA4 DebugView and in Meta Events Manager Test Events
  • Server-side conversion counts match browser-side counts within a normal margin

How to prevent it happening again

Prevention
  • Set an alert on the 5xx rate in your cloud monitoring tool
  • Keep at least two minimum instances for production tagging servers
  • Test new tags in Preview before publishing
  • Set billing alerts so a cost cap does not stop the container
  • Re-test the endpoint after every deploy, plugin update or DNS change
  • Compare server-side and browser-side conversion counts weekly
How an intermittent 5xx unfolds
  1. Day 1

    A new tag slows responses; a few requests time out with 504.

  2. Day 3

    A campaign starts. Traffic grows and more requests fail.

  3. Day 10

    Ad platform conversions look lower than orders in your shop.

  4. Day 11

    Logs show the 5xx pattern. You raise instances and fix the slow tag.

How FunnelGuard handles this

FunnelGuard detects this issue only partly. It runs your real customer journeys on a schedule and captures the status of the tracking requests sent during them, so if your server-side endpoint returns a 5xx during a check, that status is captured. A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause.

What it does not do: a check only sees the requests made during each scheduled run, so a failure that hits a small share of real visitors, or only at peak traffic, can pass between checks. It also does not read your server logs, instance metrics or the failures that happen between your server and ad platforms.

Cover the rest by hand: set up 5xx alerts in your cloud monitoring, review the server logs after traffic spikes, and compare server-side and browser-side conversion counts regularly. The Free plan includes 1 site and 2 journeys with daily checks and no card needed, and paid plans have a 3-day free trial.

Try it: endpoint overloadInteractive
Endpoint returns 5xx under load

Overloaded

Leads or data lost

Some events get 502/503/504 and never reach GA4, Google Ads or Meta, so conversions are undercounted.

Toggle to see how the endpoint state changes what the ad platforms receive.

Questions people ask

Why is my server-side GTM returning 502 or 503 errors?

Usually the container has too few instances or too little memory, so requests fail when traffic rises or an instance crashes. Check Cloud Run metrics and logs, raise minimum and maximum instances, and increase memory if you see out-of-memory errors.

What does a 504 on my tracking endpoint mean?

A 504 means the request timed out before an answer came back. It is often caused by a slow downstream API or a tag that takes too long. Fix the slow call, add timeouts and retries, or respond first and forward events in the background.

How do I find intermittent 5xx errors in my server-side tracking?

Filter your server logs for status 500 and above, and compare the times with traffic and instance metrics. You can also send repeated requests to the health URL with curl and count the non-200 answers. Check at busy times, since errors often show up under load.

Will a 5xx on the server-side endpoint hurt my ad campaigns?

Yes, indirectly. Missing conversions make reports look worse and give bidding algorithms less data to learn from. The visitor sees nothing wrong, so the loss can last a long time unnoticed.

Are 5xx errors the same as ad blockers blocking my tracking?

No. An ad blocker stops the request leaving the browser, so your server never sees it. A 5xx means your server received the request and failed to handle it, and your logs will show it.

How many minimum instances should a server-side GTM container have?

Google recommends running more than one instance for production, so a single crash or deploy does not take the endpoint down. Start with at least two and raise the maximum so it can scale during spikes.

Can FunnelGuard detect server-side 5xx errors?

Partly. FunnelGuard captures the status of tracking requests during its scheduled journey checks, so a 5xx seen in a run is caught. It cannot see failures between runs or read your server logs, so keep cloud monitoring alerts as well.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: status captured.

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.