# Postback
For Keitaro to record a conversion in statistics, the tracker must receive an incoming Postback with its own subid
click. The Postback, depending on the type of scheme, is sent:
- By affiliate network.
- By tracker integration scripts (KClient PHP, Tracking script, JS-Adapter) from sites on third-party hosts, if you do not work with affiliate networks.
- Using JS-Adapter from local sites added as archives to the tracker, if you do not work with affiliate networks.
# Postback processing
How Keitaro processes postbacks?
# Getting Postback URL
Postback URL is a link to which the sender (direct advertiser, affiliate network, etc.) transmits data on conversion, that is the fact of its commitment, conversion parameters (amount of payment, status, etc.)
If you need Postback URL for affiliate network, please read Affiliate Network Postback.
To create an individual link, open Maintenance → Postback URL.
Copy the Postback URL and add the necessary parameters from Postback Options.
# Postback parameters
- subid (required). Tracker click identificator. Used by the tracker to understand which click to record the conversion.
- tid. Transaction ID. The identifier of the serial number of the target action. For example
tid=2
means a second deposit from one player or the purchase of additional training course materials by a person who has already purchased the main material. This is an indication of an additional sale. - payout (or revenue). Amount of conversion payment.
- cost. Conversion cost for CPA and RevShare cost models).
- status (default is
sale
). Conversion status. - currency. Payout currency (usd, eur, etc.).
- From sub_id_1 to sub_id_15. Additional free parameters to update the click parameters. Any string and number values are recorded.
- return. Return custom success message. For example, with
&return=OK
Keitaro will show 'OK'. - sale_status, lead_status, rejected_status. Read Status transformations section.
- ignore_status. List of statuses that must be ignored. Example,
ignore_status=ping,test
.
# Conversion status
Keitaro supports and reports the following statuses:
- lead. Payout is not confirmed. The income on such conversions is displayed in the Revenue (hold) metric.
- sale. Payout is confirmed. The income on such conversions is displayed in the Revenue (confirmed) metric.
- rejected. Payout is cancelled. The income on such conversions is displayed in the Revenue (rejected) metric.
- rebill - Tracker has received a new transaction on
subid
, already recorded as Sale conversion in the tracker. For example, a repeated deposit. When receiving a unique transaction identifier in the&tid=
placeholder in the postback, the tracker reports such conversion as a Rebill. Income from such conversions is summed up in the Revenue (confirmed) metric, in case Rebill is turned on in the offer settings.
See also Rebills.
# Status transitions
lead
tosale
.lead
torejected
.sale
torejected
.
# Custom statuses
Custom statuses can be transformed to Keitaro statuses. Keitaro stores original status as original_status
.
# Status transformations
Example:
In the Affiliate Network placeholders list, registrations are listed as new
and reg
. Based on the available Keitaro conversion statuses, for the tracker registration is a Lead. It is necessary to specify the corresponding training in the postback link, and when receiving one of the new
or reg
statuses, the tracker will record the Lead.
status=new&lead_status=new,reg&sale_status=billed&rejected=canceled,fake
Transforms
reg
andtopup
tolead
.Transforms
billed
tosale
.Transforms
cancelled
andfake
torejected
.If you receive a conversion with
status=new
orstatus=reg
, tracker will record it in reports as Lead, because it is specified in the linkstatus=new&lead_status=new,reg
The same for other statuses, for example Sale.
By getting status=billed&sale_status=billed
the tracker understands that billed
is recorded as a Sale.
Keitaro stores raw status as "Original status" (original_status
column).
# Rebills
Keitaro handles upsells when
- Tracker already stores conversion with
status=sale
on the subid of this click - Offer allows Rebill. See Offer Settings page.
- Postback includes
tid
and it's unique. - Postback has
status
with value eithersale
orrebill
.
# Convert currency
The tracker keeps statistics in one currency specified in Service-Settings-Currency
. Pass the currency in the Postback URL in the currency=
placeholder, and the tracker will convert the postback payment amount to the currency specified in the settings. Example:
https://example.com/key/postback?status=lead&payout=10¤cy=EUR
Now Keitaro does not store payouts in different currencies for each campaign separately. The currency of the statistics is set at the tracker level. The tracker converts the payout amount from the currency specified in the Postback URL.
# Postback FAQ
Why I don't see conversions?
See Postback Troubleshooting page.
How to send postback as tracking pixel?
Example:
<img src="%%POSTBACK_URL%%?status=lead&payout=10¤cy=usd" width="1" height="1" />
How Keitaro converts currency?
Keitaro requests daily an external web service for all the currency rates.
Why sending test postback doesn't work?
Usually affiliate networks don't send real subid. That's why Keitaro ignores these postbacks.
Postback key
That is a unique for each tracker string. It protects Keitaro of receiving non-authorized postbacks.
To change postback key, edit /etc/keitaro/config/tracker.env
and set it in the line:
POSTBACK_KEY=CUSTOM_KEY
Then reconfigure system
kctl tune