Search documentation

Search titles, headings, and page summaries.

Server-side tracking

Send a custom event from your backend using a Website-scoped server key.

Updated 2026-11-05

Server-side tracking is useful when a completed action is known only to your backend.

Before you send an event

Create a Custom events server API key for the Website under Website → Settings → Developer. Keep it in a server environment variable and send it as a Bearer token to POST /api/collect/server.

Website Developer settings with a server key name, Custom events purpose selector, Create key, and a masked existing key Open full size

Choose the purpose for the endpoint you will call. This sample shows Custom events; Stripe attribution is a separate purpose. Existing keys display a hint, not the full secret.

Illustrative sample data.

Server events can be joined to browser journeys using the Graytower visitor ID. Include the visitor's _gt_id cookie value as anonymousId. Do not invent a new ID: a generated UUID will not join the original visitor's Money Map journey. Use a stable UUID as eventId when retrying the same action.

JavaScript
const visitorId = request.cookies.get("_gt_id")?.value;
await fetch("https://graytower.app/api/collect/server", {  method: "POST",  headers: {    Authorization: `Bearer ${process.env.GRAYTOWER_SERVER_EVENT_KEY}`,    "Content-Type": "application/json",  },  body: JSON.stringify({    type: "account_created",    eventId: crypto.randomUUID(),    anonymousId: visitorId,    params: { plan: "pro" },  }),});

See the Events API for the exact request fields and responses. For Stripe payment matching from your server, use a Stripe attribution key and the payment matching guide.

Check the result

A 204 response means the request was accepted. Check the corresponding custom event in Goals or a Funnel after processing. If the event is absent, verify the Website key purpose, UUID fields, and tracked-event usage.