Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Server events missing client IP and user agent: how to fix it

TRK-369Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

Where the visitor's details get lost
  1. Visitor submits formBrowser request carries real IP and user agent
  2. Your server or webhookEvent is built without copying those values
  3. Event sent to platformArrives with no IP, or your server's IP
  4. MatchingEvent can't be tied to the ad click

The browser request has the real IP and user agent. They are dropped before the event is sent on.

Why it costs you leads or sales

Matched conversions with and without IP and user agentExample numbers
Matched conversions with and without IP and user agent (example)Real leads: 100 conversions; Matched, IP and UA sent: 82 conversions; Matched, IP and UA missing: 55 conversions038771008255Real leadsMatched, IP and UA se…Matched, IP and UA mi…conversions

Example: 100 real leads in a week. Illustrative numbers only; your results will differ.

How to check if your site has it

Check your server events
  1. Open the platform's diagnostics

    In Meta Events Manager, open your pixel or dataset, then the Overview and Diagnostics tabs. Look at Event Match Quality and any warning about missing customer information parameters. In TikTok Events Manager, check the event details for matching warnings.

  2. Use the test events tool

    In Meta Events Manager, open Test events, copy the test code, and add it to your server event as test_event_code. Trigger a real test conversion and open the received event to see which user data fields arrived.

  3. Read the raw payload

    Log or inspect the JSON your server sends. Look for client_ip_address and client_user_agent inside user_data. If they are absent, or the IP is one of your own server's, you have the issue.

  4. Compare with browser events

    If you run the browser pixel and the server event together, compare their match quality and counts. A big gap on server events points at missing signals.

How to fix it

Pass the visitor's IP and user agent
  1. Read the headers from the visitor's request

    Take the user agent from the User-Agent header. Take the IP from the connection, or from X-Forwarded-For if you sit behind a proxy or CDN. Use the first address in that list, and only trust the header from proxies you control.

  2. Add both to user_data

    Set client_ip_address and client_user_agent in the event body. Send them as plain values, not hashed. Hash only fields like email and phone.

  3. Keep them when events are queued

    If you send events later from a background job, store the IP and user agent when the request happens. Otherwise the job will send its own values.

Meta Conversions API event with the required fieldsjson
{
  "data": [{
    "event_name": "Lead",
    "event_time": 1735689600,
    "action_source": "website",
    "event_source_url": "https://example.com/thank-you",
    "user_data": {
      "client_ip_address": "203.0.113.42",
      "client_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...",
      "em": ["<sha256 of lowercase email>"]
    }
  }]
}
Read the visitor's IP and user agent in PHPphp
<?php
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '';
// Behind a trusted proxy or CDN only:
$fwd = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? '';
$ip = $fwd ? trim(explode(',', $fwd)[0]) : ($_SERVER['REMOTE_ADDR'] ?? '');

$user_data = [
  'client_ip_address' => $ip,
  'client_user_agent' => $ua,
];
Event payload before and after

Before

  • user_data has only a hashed email
  • Or the IP is your server's
  • Platform reports low match quality

After

  • user_data includes visitor IP and user agent
  • Hashed email and click IDs sent alongside
  • More conversions matched to ads

How to confirm it's fixed

Confirmation checklist
  • Send a test event with the platform's test code and see client_ip_address and client_user_agent in the received data
  • Check the IP differs from your server's and matches the device you tested with
  • Confirm different test visits show different IPs
  • Watch Event Match Quality over the next few days for improvement
  • Check browser and server events still deduplicate (same event_id on both)

How to prevent it happening again

Prevention habits
  • Store IP and user agent with the lead or order at the moment of the request, so later jobs can reuse them
  • Add a test that fails if user_data lacks these fields
  • Re-run a test event after changing hosting, CDN, proxy or plugins
  • Check Events Manager diagnostics monthly
  • Note in your docs which header your proxy uses for the real IP

How FunnelGuard handles this

Questions people ask

Why is my Meta Conversions API event match quality low?

A common cause is missing customer information, especially client_ip_address and client_user_agent. Check a received event in Test events to see which fields arrived. Also send a hashed email, phone number and the fbp and fbc values where you have them.

Is client_user_agent required for Meta Conversions API?

Yes, for events with action_source set to website, Meta requires client_user_agent. The client_ip_address is not strictly required but is strongly recommended, because it improves matching.

Why do all my server events show the same IP address?

Your server, cloud function or automation tool is sending its own IP instead of the visitor's. Capture the IP from the original browser request, or from the forwarded header behind a proxy, and include it in each event.

How do I get the visitor's real IP behind Cloudflare or a proxy?

Read the forwarded header your proxy sets, such as X-Forwarded-For, and use the first address. Only trust that header when it comes from a proxy you control, since visitors can fake it otherwise. Your CDN's documentation names the exact header.

Should I hash the IP address and user agent?

No. For Meta, client_ip_address and client_user_agent are sent as plain values. Hash fields such as email and phone number using SHA-256 after trimming and lowercasing.

Can I send the IP and user agent from a webhook or Zapier?

Only if you captured them earlier and pass them through. A webhook that runs on a vendor's servers has that vendor's IP. Save the visitor's values on the form submission, then include them in the event.

Does FunnelGuard detect missing IP or user agent in server events?

No, not yet. It is a possible future check. FunnelGuard does monitor your journeys and the tracking hits sent to ad platforms, so you can catch broken forms and tags, but use Events Manager diagnostics for payload details.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: match key coverage (IP address, user agent) in event match quality; Meta dataset quality (Stage 22, daily with the site's Meta connection; Meta's answer format to be confirmed on the first real dataset).

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.