> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tracking API overview

> The Layers Tracking API ingests storefront events — product views, clicks, add-to-cart, search, and block engagement — to power analytics, ranking signals, and merchandising performance reports.

The Tracking API is a dedicated, low-latency ingestion service that runs on its own host, separate from the main Layers Storefront API. It's optimized for being called from the browser using `navigator.sendBeacon` or `fetch` with `keepalive`, so events keep flowing even as shoppers navigate between pages.

## Why a separate API?

The Tracking API is split out from the main API Reference for three reasons:

* **Different host.** Events ship to `https://cl.uselayers.com/beacon`, not `https://app.uselayers.com/api/storefront/v1`. The collection endpoint is deployed globally as a Cloudflare Worker for minimum write latency from any region.
* **Different auth model.** The Tracking API accepts the storefront token either as the `X-Storefront-Access-Token` header **or** as a `?token=` query parameter. Query‑parameter auth exists specifically so `navigator.sendBeacon` calls — which can't set custom headers — still authenticate correctly.
* **Different response contract.** Successful writes return `201` with an empty body. Events are validated and dispatched asynchronously; invalid events inside a batch are dropped silently so one bad event doesn't fail the whole batch.

## Base URL

```text theme={null}
https://cl.uselayers.com
```

There's only one endpoint today: `POST /beacon`.

## When to call it directly

Most stores don't need to. If you use the [Storefront Pixel](/shopify-integration/storefront-pixel) or the [Layers JavaScript SDK](/sdk/overview), tracking is wired up automatically and you can skip this section.

Call the Tracking API directly when you're:

* Building a custom storefront (headless, Hydrogen, Next.js Commerce) where the pixel isn't loaded.
* Instrumenting a mobile app or native shopping channel.
* Backfilling events from a server-side process or third-party tag manager.

## Next steps

* [Authentication](/tracking-api/authentication) — how to pass the storefront token.
* [Send events](/tracking-api/send-events) — the full `POST /beacon` reference.
* [Event types](/tracking-api/event-types) — payload schemas for every supported event.
* [Sending events with `navigator.sendBeacon`](/tracking-api/guides/send-beacon) — recommended browser pattern.
