Skip to content

trackkit / dispatcher/types / ProxyTransportOptions

Type Alias: ProxyTransportOptions

ProxyTransportOptions = object

Defined in: dispatcher/types.ts:49

Sends analytics to a same-origin (or explicitly allowed) proxy URL which forwards to the real provider.

This usually bypasses ad blockers that target known analytics domains or third-party scripts.

Recommended server contract:

http
POST {proxyUrl}
Headers:
  Content-Type: application/json
  Authorization: Bearer <token>         (optional)
  X-Trackkit-Target: <provider URL>     (required)
Body: { "payload": any }

The server should validate the target against an allowlist and forward the JSON payload to that URL, returning the provider response status.

Properties

proxyUrl

proxyUrl: string

Defined in: dispatcher/types.ts:55

URL of the proxy endpoint to send analytics through.

Example

ts
"/api/trackkit"

token?

optional token: string

Defined in: dispatcher/types.ts:60

Optional bearer token for proxy authorisation.


headers?

optional headers: Record<string, string | undefined>

Defined in: dispatcher/types.ts:65

Additional static headers to include in proxy requests.


keepalive?

optional keepalive: boolean

Defined in: dispatcher/types.ts:70

If true, use fetch({ keepalive: true }) for nicer unload semantics.


allowlist?

optional allowlist: (string | RegExp)[]

Defined in: dispatcher/types.ts:78

Optional allowlist enforcement client-side (defence-in-depth).

When set, the proxy target URL must match at least one entry in this list or the request will be blocked by the client.

Released under the MIT License.