<a id="payload-format"></a>

# Payload format

Below is a description of the payload format used for the rewritten URL:s and tracking pixels.
This is only relevant if you want to implement a custom tracking service rather than the one we provide, otherwise, see the [events](tracking_events.html.md) section.

The payload format is a [base64url](https://en.wikipedia.org/wiki/Base64#URL_applications) encoded string where:

* The first byte is the [`tracking.secret.id`](config.html.md#confval-tracking.secret.id).
* The next 32 bytes is a HMAC SHA-256 hash of the tracking data using the [`tracking.secret.key`](config.html.md#confval-tracking.secret.key).
* All the bytes after this is for the tracking data which is a JSON object compressed using zlib DEFLATE (without an appended zlib header) in the following format:

```JSON
{
    "r": "john.doe@example.com",
    "m": "<36e76ce2-b5a6-11ec-b8dd-000c292d8854@c568c9a1654f>",
    "u": "http://example.com/example/path",
    "a": {}
}
```

> **Note**
> 
> We also have a [HSL module](https://github.com/halon-extras/tracking)  if you want to implement engagement tracking during SMTP submission as well.
