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

# Send through your own domain

> Forward the JavaScript SDK's batches through a path on your own site, so a blocker list that names the Maqetin host does not stop your events.

Ad blockers and tracker lists block known analytics hosts. If a list names `in.maqetin.com`, a visitor who uses it sends nothing: no events reach the profile and no journey starts for them. Calls from your server are not affected. On a web page, send through a path on your own site and let your server forward it.

```mermaid theme={null}
sequenceDiagram
  participant P as Your page
  participant S as Your server
  participant M as in.maqetin.com
  P->>S: POST /relay/v1/batch
  S->>M: POST /v1/batch
  M-->>S: Status, Retry-After, body
  S-->>P: The same answer, unchanged
```

**1. Choose a path your site does not use**

This page uses `/relay`. Use a short word that says nothing about what the path does.

**2. Forward the batch route**

Forward `POST /relay/v1/batch` to `https://in.maqetin.com/v1/batch`, following the rules below.

**3. Give the path as `endpoint`**

The SDK adds `/v1/batch` to it.

```ts theme={null}
const mq = new MaqetinClient({ publicKey: 'mq_live_…', endpoint: '/relay' });
```

* Blocker lists also match paths. Do not put `track`, `analytics`, `collect` or `pixel` in the path, and do not name it after an analytics product, Maqetin included.
* You cannot change the `/v1/batch` part of the request path. A full address on the page's own origin, such as `https://brand.example/relay` for a page on `https://brand.example`, works the same way.
* A path works on a web page only; in Node, give the full address. The page sends to its own origin, so the browser makes no cross-origin request and no CORS preflight.

## Proxy rules

The proxy must:

* Forward `POST <path>/v1/batch` as `POST /v1/batch` on `in.maqetin.com`. The gateway matches `/v1/batch` exactly: lower case, no trailing slash.
* Send `Host: in.maqetin.com`, and the TLS name `in.maqetin.com` over HTTPS.
* Keep the `Authorization` header (it holds the key), the `Content-Type` header and the body unchanged.
* Return the gateway's status, `Retry-After` header and body unchanged.
* Accept a request body of 512 KiB or more. The SDK keeps a batch under about 480 KB; the gateway refuses more than 512 KiB.

The proxy must not:

* Cache the answer.
* Retry on its own. The SDK already retries with backoff and the same message ids; a second layer multiplies the load while Maqetin is slow and hides the 429 from the SDK.
* Log the body. It holds your visitors' data.

The proxy does not need to add the visitor's IP address (`X-Forwarded-For` and similar). The gateway does not read it, and it limits requests per key.

The SDK retries on 5xx, 429 and network errors, waiting for `Retry-After` up to `retryMaxMs`. If the proxy answers 200 for a batch Maqetin did not accept, the SDK takes the events as sent and reports nothing. If it answers another 4xx in place of a 429, the SDK drops the events and reports them to `onError`.

## Check it works

Open your site and cause one event. In the browser's network tab, find the `POST` to `/relay/v1/batch`; it must go to your own domain.

| Status | What it means |
| - | - |
| `202` | Maqetin accepted the batch |
| `401` | The gateway saw no active key. Check that the proxy forwards `Authorization`, and that the key is active |
| `404` | The path did not become `/v1/batch` |


## Related topics

- [JavaScript SDK](https://docs.maqetin.com/sdk/javascript.md)
- [Quickstart](https://docs.maqetin.com/quickstart.md)
- [Sending domains](https://docs.maqetin.com/messaging/sending-domains.md)
- [Deliverability](https://docs.maqetin.com/messaging/deliverability.md)
- [Email](https://docs.maqetin.com/messaging/email.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.