Quick answer
A web beacon is a small, invisible request that a web page or email makes to a server so the server can record that the content was loaded. It is usually a one-pixel image; the browser's Beacon API (navigator.sendBeacon) does the same job for data sent as a page closes.
Formula: Events per beacon = 65,536 bytes ÷ bytes per event
What is a web beacon?
A web beacon is a small, invisible request that a web page or an email makes to a server so the server can record that the content was loaded. The classic form is a one-pixel transparent image, also called a pixel tag, web bug or clear GIF. When the image loads, the server sees the request and can log the time, the IP address, the browser type and any cookies it set earlier. Nothing appears on screen.
The word has a second meaning in web development. Browsers expose a Beacon API, navigator.sendBeacon(), that fires a one-way request to a server and keeps going even while the page is closing. This page covers both, because most analytics code today uses the second one to do the job the first one started.
One thing this page does not cover: a Bluetooth beacon, the small radio transmitter that shops and museums use to announce their location to phones. The top results for "what is beacon" are mostly about those; the results for "what is a web beacon" are about the tracking technique described here.
Two things people call a beacon
| Pixel-style web beacon | Beacon API (navigator.sendBeacon) | |
|---|---|---|
| What it is | An invisible image (or tiny script) the page or email asks the browser to load | A browser function that queues a POST request |
| Where it runs | Web pages and HTML emails | Web pages only, in JavaScript |
| How data travels | In the image URL's query string, plus whatever cookies the browser attaches | In the request body (a string, a Blob, form data) |
| Size limit | Whatever the URL length allows | 64 KiB of queued data in total |
| Response | The server returns an image; the page can ignore it | None you can read. It returns true or false |
| Typical use | Email opens, ad conversions, older analytics tags | Time on page, last-moment analytics events |
For the pixel side, including email opens and ad conversion pixels, see tracking pixel. The rest of this page is mostly about the second column, because it is the part that decides whether your last few seconds of data arrive.
What the server actually receives
A beacon is a normal HTTP request, so the server learns what any request reveals and nothing more:
- The page or script triggers the request. An
<img>tag points athttps://collector.example/b.gif?page=/pricing, or JavaScript callsnavigator.sendBeacon("https://collector.example/b", data). - The browser sends it. Along with the URL or body, the request carries the usual headers: user agent, referrer and, if the host set one earlier, cookies.
- The server logs it. Typical fields are the time, the IP address (many systems truncate or discard it), the user agent and the parameters the sender put in.
- The server answers with something trivial, such as an image, or an empty
202or204response. The visitor sees nothing.
A beacon can only report what its sender chose to put in the URL or body, plus what the browser attaches automatically. It cannot read the page. Whether it can recognise a returning visitor depends on whether a cookie or another identifier travels with it, which is why beacons are often paired with cookies. Email beacons do not need cookies at all, which makes them harder to block.
Why last-moment data needs the Beacon API
The hard moment for analytics is the end of a visit: the tab closes, the user taps a link, the phone switches apps. Before the Beacon API, pages tried to hold the browser open long enough to send data: a synchronous XMLHttpRequest, an image created at the last second, or a loop that did nothing. MDN notes that all of these block unloading and slow down the next navigation.
sendBeacon hands the request to the browser to send when it can, without delaying the page. Three rules follow from the specification and MDN:
truemeans queued, not delivered. The function returnstrueif the browser accepted the data for transfer. It cannot tell you the server received it.- Keep the payload small. The total queued data is limited to 64 KiB (65,536 bytes). If the data is over the browser's limit, the call returns
falseand nothing is sent. - Send on
visibilitychange, notunload. MDN says the most reliable moment is when the page becomes hidden. Theunloadevent is unreliable, especially on mobile, and is incompatible with the browser's back/forward cache.pagehidehas the same reliability problems.
When you need a response, or control over headers, fetch() with keepalive: true also lets a request outlive the page. Its body is limited to 64 KiB as well.
Sizing a beacon: a worked example
Sample data: a page buffers analytics events in memory and sends them when the tab is hidden. Each event serialises to about 280 bytes.
| Strategy | Events in the buffer at hide | Payload | Fits in 64 KiB? |
|---|---|---|---|
| Send everything at the end | 400 | 400 × 280 = 112,000 bytes = 109.4 KiB | No: the call returns false, all 400 events are lost |
| Flush every 50 events, send the rest at hide | at most 49 | 49 × 280 = 13,720 bytes = 13.4 KiB | Yes, with 4.8 times headroom (65,536 ÷ 13,720) |
The 64 KiB budget holds 234 such events (65,536 ÷ 280 = 234.06), so a visit with more than 234 events cannot be sent in one beacon. The fix is not a smarter beacon but an earlier flush: send during the visit, and keep only a small tail for the exit.
Where beacons get lost
A beacon that never leaves the browser leaves no trace on your server, so the failure looks like missing data rather than an error.
| Cause | What happens | How to tell |
|---|---|---|
| A content blocker drops the collector's hostname | The request is never made; realtime never shows the visit | The network panel shows no request to the collect host |
A content security policy's connect-src omits the collect host | Both sendBeacon and fetch fail, and the page shows no error | Same: no request in the network panel, and the browser console may report a policy violation |
| Do Not Track or Global Privacy Control is on | A script that respects them does not send at all | The script returns before sending anything |
| The page closed before the request left | Nothing retries it if the sender has no queue | Gaps cluster at exits, such as time on page |
Blockers also act on the pixel kind: Wikipedia lists disabling image loading, plain-text email clients and browser extensions as ways users block them. See ad blocker for what blockers do to analytics in general.
Common mistakes
- Treating
trueas proof of delivery. It only confirms the browser queued the request. Verify arrival on the server side or in a realtime report. - Sending everything at unload. The earlier the flush, the less you lose to an exit that never fires an event.
- Putting personal data in the URL of a pixel. URLs end up in server logs, proxies and browser history. Send identifiers only when you need them, and keep emails and names out of query strings.
- Assuming a beacon needs a cookie. It does not. A script can send a beacon with no cookie and no local storage; what it loses is the ability to recognise a returning visitor by cookie. See first-party cookie.
- Reading a 200, 202 or 204 as "stored". A server can accept a request and still drop the event, so a success status says nothing about what was kept.
Checking beacons in TapCub
Suppose you installed the TapCub script and want to be sure the data really leaves the browser, including the last seconds of a visit.
- Know what the script sends. Each pageview is one request to the collect endpoint (the script's origin plus
/api/v1/pulse). It prefersnavigator.sendBeaconand falls back tofetchwithkeepaliveand no credentials. The first pageview of a page load uses afetchthat can read the response, because the response carries the site config that decides whether to load chat or the identity script. - Know when time on page is sent. On a route change, when the tab hides or when the page closes, if the page was open for more than one second the script sends a
__leaveevent with the duration in milliseconds. - Confirm arrival in Web analytics › Realtime. Open your site; within a few seconds your pageview should appear in the people feed. The collector returns
202both for stored hits and for dropped ones, so the status code alone does not tell you. - If realtime stays empty, open the browser's network panel. No POST to the collect host means the browser or a blocker stopped it. Allow the script host and the collect host in
connect-src(without chat,static.pathclue.comandapi.pathclue.comfor the Americas region). TapCub does not bypass blockers or Do Not Track. - Remember there is no queue in the browser. The website script does not retry; a hit that did not leave before the page closed is gone. The script itself writes neither a cookie nor local storage.
Sources
- MDN Web Docs, Navigator: sendBeacon() method.
- W3C, Beacon (Candidate Recommendation Draft, 3 August 2022).
- MDN Web Docs, RequestInit: keepalive property.
- Wikipedia, Web beacon.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Technical Engineer
Focuses on tracking code, SDKs, and API integrations, with practical guidance on implementation checks and troubleshooting.