# Connect Keitaro

Report new fans, payments and commissions from OnStat to your Keitaro tracker, step by step.

Source: https://onstat.io/docs/keitaro (updated 2026-11-20)

## How the two links work

Two links connect Keitaro and OnStat. Only the first one carries parameters.

1. **Campaign link, from Keitaro to OnStat.** Keitaro adds its click ID to it on every click.
2. **Postback address, from OnStat to Keitaro.** OnStat adds the click ID, the status and the amount itself, so you paste the address only.

## Optional: a domain with HTTPS

OnStat sends to `https://` and `http://` addresses, so the address Keitaro shows on its IP number works as it is. Over `http://` the key in the address travels unprotected. HTTPS needs a certificate, and Keitaro gets one for a domain, not for the server's IP number. To set one up:

1. In Keitaro, open Domains and add your domain.
2. At your domain registrar, point the domain's A record at your tracker's server.
3. Wait until Keitaro shows the domain with the status OK. Keitaro requests the free certificate itself.

## 1. Put the campaign link into Keitaro

1. In OnStat, open your campaign and copy `Link for your tracker`. It ends with `subid={subid}`.
2. In Keitaro, paste it as the URL of your offer, exactly as copied.

Keitaro replaces `{subid}` with its click ID. OnStat keeps that ID and sends it back with every event of the fan.

## 2. Copy your postback address from Keitaro

In Keitaro, open Settings, then Postback URL. Keitaro shows a template with parameters. Take the part up to `/postback`. If you set up a domain with HTTPS, put it in place of the IP number.

Keitaro shows:

```
http://203.0.113.10/1a2b3c4/postback?subid=REPLACE&status=REPLACE&payout=REPLACE
```

You paste into OnStat:

```
https://your-domain.com/1a2b3c4/postback
```

## 3. Create the integration in OnStat

1. In Integrations, start a new Keitaro integration and paste the address into `Postback URL`.
2. Under `What it sends`, choose the events and amounts Keitaro should get.
3. Open your campaign, go to its Integrations tab and add the integration.

## 4. Check that it works

The Keitaro integration has no test send, so the first real fan is the check. After a click from Keitaro brings a fan:

- In OnStat, Sent postbacks lists what was sent.
- In Keitaro, open Maintenance, then Logs, then Postbacks to see what arrived.

## What OnStat sends

OnStat adds these fields to your address on every postback. That is why the address you paste has none of them.

| Field | What it carries |
| --- | --- |
| `subid` | The Keitaro click ID that arrived with your campaign link. |
| `status` | `lead`, `sale` or `rejected`. The next table says when each one is sent. |
| `tid` | The ID of the event in OnStat. Keitaro uses it to tell one conversion from another. |
| `payout` | The amount in US dollars, or `0.00` when the event carries no amount. |
| `currency` | Always `usd`. |
| `return` | Always `OK`: the reply OnStat asks Keitaro to give. |

Which statuses you get, and with what amount, follows from `What it sends` in the integration.

| Status | When OnStat sends it |
| --- | --- |
| `lead` | A fan subscribed, or a commission was earned and is still on hold. Also a click, if you turn clicks on. |
| `sale` | A fan paid, or a commission is ready for payout. |
| `rejected` | A commission was cancelled. |

Clicks are off until you turn them on under `What it sends`. Keitaro counts the click itself, so a click from OnStat arrives as one more lead, and Keitaro cannot tell it from a subscription. Turn clicks on only if you want a lead for every visitor who reached the OnStat link.

To tell clicks from subscriptions, or to choose the parameter names yourself, use a Postback URL integration: see [Postbacks](/docs/postbacks).

## If postbacks do not arrive

| What you see | What to do |
| --- | --- |
| OnStat does not accept the address | Start it with `https://` or `http://` and end it at `/postback`. Leave out the question mark and everything after it. |
| Keitaro logs "Click for subid not found" | The campaign link in Keitaro is missing `subid={subid}`, so OnStat never got the click ID. Copy the link from your campaign again and paste it as it is. |
| Keitaro logs "Incorrect postback code" | The key in the address is wrong. Copy the address from Keitaro again and create a new integration with it: a saved integration keeps its address. |
| Nothing shows in Keitaro at all | Open Sent postbacks in OnStat. If nothing is listed there either, the integration is not added to the campaign, or it is disabled. |
| The click is older than 90 days | OnStat keeps click IDs for 90 days. Later events of that click are not sent to Keitaro. |

How postbacks are delivered, retried and what each failure reason means: [Postbacks](/docs/postbacks#delivered-retried-failed).

Keitaro's own guide: [Postback in the Keitaro documentation](https://docs.keitaro.io/en/conversions-and-postback/postback.html).
