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

# Server-side tracking

> Send events to GhostlyX from your server using the Events API.

## When to use server-side tracking

Use the Events API when:

* You need to record a conversion that happens entirely on the server (for example, a payment confirmation received via webhook)
* You are building a server-rendered application without a browser front-end
* You want to guarantee an event is recorded even if the visitor's browser blocks JavaScript

## Endpoint

```
POST https://ghostlyx.com/api/event
```

## Headers

| Header         | Value                                    |
| -------------- | ---------------------------------------- |
| `Content-Type` | `application/json`                       |
| `User-Agent`   | The visitor's original User-Agent string |

## Request body

```json theme={"dark"}
{
  "domain": "yourdomain.com",
  "name": "Purchase",
  "url": "https://yourdomain.com/checkout/success",
  "props": {
    "plan": "pro",
    "revenue": 49.99
  }
}
```

| Field    | Required | Description                                          |
| -------- | -------- | ---------------------------------------------------- |
| `domain` | Yes      | The domain as configured in GhostlyX                 |
| `name`   | Yes      | The event name. Use `pageview` to record a pageview. |
| `url`    | Yes      | The full URL where the event occurred                |
| `props`  | No       | Object of string or number properties                |

## Response

`202 Accepted` on success. No response body.

## Example: cURL

```bash theme={"dark"}
curl -X POST https://ghostlyx.com/api/event \
  -H "Content-Type: application/json" \
  -H "User-Agent: Mozilla/5.0 ..." \
  -d '{
    "domain": "yourdomain.com",
    "name": "Purchase",
    "url": "https://yourdomain.com/checkout/success",
    "props": { "plan": "pro", "revenue": 49.99 }
  }'
```

## Connecting to goals

Server-side events are matched to [Custom event goals](/analytics/goals) by event name, the same as client-side events.
