# Conversion tracking and webhooks

Measure what happens after the click, and push link events to your own systems.

Canonical: https://easerix.com/docs/links/conversions-and-webhooks

<Answer>
Links can follow what happens after the click. Conversion tracking appends a
click ID to your destination that your site reports back — with an optional
value — and outbound webhooks POST signed JSON to your endpoint whenever
links are created, updated, deleted, or clicked. Turn on conversion tracking
per link; manage webhooks in Settings.
</Answer>

## Conversion tracking

No pixel, no JavaScript snippet — conversions are reported server-to-server, keyed on a click ID.

1. Open a link's detail page and switch **Conversion tracking** to **On**.
2. From then on, every redirect appends `?esrx_id=<click id>` to the destination URL. Existing query parameters are preserved.
3. Have your site capture and store `esrx_id` when the visitor lands.
4. When the visitor converts, call `POST /v1/track/conversion` from your backend with the `clickId` — plus an optional `name` (like `signup` or `purchase`), `amountCents`, and `currency` if you want revenue attached.

Conversion counts appear on the link's detail page, and workspace-wide **Conversions** and **Revenue** cards appear on the Analytics page.

Clicks are recorded within about a second of the redirect, so a conversion fired instantly after landing can briefly arrive first — the API tells you to retry once, and that's all it takes.

## Outbound webhooks

Webhooks are configured for the whole workspace under **Settings → Webhooks**.

### Set one up

1. Choose **Add**, enter an `https://` endpoint URL, and pick the events to receive.
2. Choose **Create**. The **signing secret** (`whsec_…`) is shown **once** — store it immediately.
3. Use **Test** any time to send a `ping` event to your endpoint.

### Events

| Event | Fires when |
|---|---|
| `link.created` | A link is created |
| `link.updated` | A link changes (including pause, archive, and bulk actions) |
| `link.deleted` | A link is deleted |
| `link.clicked` | A link gets clicks — batched, with `clicks` and `totalClicks` counts, not one call per click |

Payloads look like `{"event": "…", "at": "<UTC timestamp>", "data": {…}}`.

### Verify signatures

Each delivery is signed with HMAC-SHA256 over the raw request body using your signing secret:

| Header | Contents |
|---|---|
| `X-Easerix-Signature` | `sha256=<hex digest>` — recompute and compare |
| `X-Easerix-Event` | The event name |
| `X-Easerix-Delivery` | A unique delivery ID, stable across retries |

### Delivery and retries

- Any 2xx response counts as delivered. Failures retry twice (about 1s and 5s later) — three attempts total.
- After 20 consecutive failures the webhook pauses itself; fix your endpoint and press **Activate** to resume with a clean slate.
- The row shows last delivery status and any consecutive-failure streak at a glance.

## Frequently asked questions

### I lost my signing secret — can I see it again?

No — it's shown only at creation. Delete the webhook and create a new one to get a fresh secret, then update your endpoint's verification key.
