ADL-006
Gross or net: where the reward split happens
Set the network's user percentage to 100 and split in your own code, or let them split and accept that your postbacks no longer show you the margin.
AdsLab applies a per-type user reward percentage on their side before the postback leaves. That one setting decides what your own database can ever know.
Leave the percentages at the network's split and the postback carries the user's share. Your site credits exactly what arrives, which is simple — and your revenue reporting is now blind, because the gross never reaches you. The money card on your dashboard cannot show a real margin.
Set every type to 100% and the postback carries the gross. You do the split, you keep both numbers, and your reporting is honest. The cost is that your share now lives in your code, so a mistake there is a mistake in what you pay.
Neither is wrong. Pick deliberately, because switching later changes every historical figure's meaning.
// With network percentages at 100%, the postback carries the GROSS.
function credit_from_gross(PDO $pdo, int $userId, string $grossDecimal, string $type, string $txid): void
{
$grossUnits = (int) round(((float) $grossDecimal) * 100000000);
// Per-type share, so surveys and shortlinks can pay differently.
$sharePct = (float) setting('share_' . $type, setting('share_default', '60'));
$userUnits = (int) floor($grossUnits * $sharePct / 100);
$houseUnits = $grossUnits - $userUnits;
$pdo->beginTransaction();
try {
$pdo->prepare('UPDATE users SET balance = balance + ? WHERE id = ?')
->execute([$userUnits, $userId]);
// Both halves recorded: this is what makes margin reporting possible.
$pdo->prepare(
'INSERT INTO revenue (txid, type, gross_units, user_units, house_units, created_at)
VALUES (?, ?, ?, ?, ?, NOW())'
)->execute([$txid, $type, $grossUnits, $userUnits, $houseUnits]);
$pdo->commit();
} catch (Throwable $e) {
$pdo->rollBack();
throw $e;
}
}
Using it
Record gross, user and house on every conversion. Deriving the house share later from a percentage that has since changed gives you the wrong history.
Keep the percentages per type. A shortlink and a survey have very different economics and one global number flatters one and starves the other.
Write down which side is splitting, in the admin help text. It is the first thing you will forget.
What bites people
Floor the user's share. Rounding up on every conversion is a slow leak with no entry explaining it.
Changing the network-side percentage silently changes what your postbacks mean. Record the date you changed it.
With the network splitting, do not label your dashboard figure "revenue". It is payout.
This one touches real money. Point it at a throwaway wallet and watch a full cycle before you trust it with a live balance.