Rule self_referral, read from the engine code

Affiliate self-referral fraud, held before payout

Affiliate self-referral fraud is an affiliate buying through their own link to earn commission on their own purchase. The engine compares the buyer's email with the affiliate's and holds the commission when they match.

By the AffiliateTracking teamUpdated 5 min read

Fraud page on demo data: held commissions, each with the rule that held it and Release and Uphold buttons, above the verdicts that explain each hold.

The fraud queue in the product, running on demo data.

The short answer

The rule fires when the buyer's email matches the affiliate's own email. It ignores case, anything after a plus sign, and dots in Gmail addresses. It holds that one commission until you release or uphold it.

How the rule works

Read from internal/fraud/engine.go. The code fixes the thresholds. No setting changes them.

  1. 01One email comparison

    Each credited sale carries the buyer's email from your billing tool. The engine cleans both addresses the same way and compares them.

  2. 02Aliases cleaned first

    Both addresses lose case and anything after a plus sign. Gmail and Googlemail addresses also lose their dots, and googlemail.com counts as gmail.com.

  3. 03It holds that sale

    A match holds the commission under review. Nothing else in the affiliate's balance moves, and you decide in the fraud queue.

The exact logic

// internal/fraud/engine.go, SelfReferral (condensed)
if normalizeEmail(affiliate.email) == normalizeEmail(buyerEmail) {
    hold(commission)   // "The buyer's email ... is the partner's own email"
}
// normalizeEmail: lowercase, cut "+tag", drop dots on gmail.com
//                 and googlemail.com (googlemail becomes gmail)

Condensed from the Go source in v0.5.0 (main 4f87f77). Comments are ours.

The signals

  • Buyer email equals the affiliate's email after cleanup
  • Plus tags cut on every domain
  • Dots ignored on Gmail only
Hold scope. It holds only the commission being screened. Nothing else in the affiliate's balance moves.

Our data

We ran the rule at its threshold

We ran 5 fixtures through the real engine on 3 Oct 2026: 2 below the line, 3 at or past it. These are the results and the engine's own words.

self_referral · 5 fixtures · fresh SQLite each
Each fixture run through the real engine, and whether self-referral fired
FixtureResultThe engine's reason
Affiliate Owner@Gmail.com, buyer o.w.n.e.r+shop@gmail.comFiredThe buyer's email "o.w.n.e.r+shop@gmail.com" is the partner's own email
Affiliate Owner@Gmail.com, buyer owner@googlemail.comFiredThe buyer's email "owner@googlemail.com" is the partner's own email
Affiliate Owner@Gmail.com, buyer owner2@gmail.comSilentNo verdict
Affiliate jane.doe@example.com, buyer jane.doe+deal@example.comFiredThe buyer's email "jane.doe+deal@example.com" is the partner's own email
Affiliate jane.doe@example.com, buyer janedoe@example.comSilentNo verdict
Dots only count on Gmail. On other domains, jane.doe and janedoe are different people to the engine.

Method: one Go test against engine v0.5.0 (main 4f87f77), a new SQLite database per fixture, dry run so nothing was held. Re-run with go test ./internal/fraud/ plus the fixture list above.

What lands in your queue

When self-referral fires, the verdict shows the rule, who it's about and what it saw. Release or uphold is your call, not the engine's.

Fraud queue · self_referral · demo dataMade-up numbers, real wording
Example held commission after self-referral fired, on demo data, with the engine's reason text
PartnerWhat it sawCommissionResult
Affiliate 7The buyer's email "o.w.n.e.r+shop@gmail.com" is the partner's own email$112.40Commission held
heldWaits for youThe commission stays out of payouts until you decide.
releasedPaid normallyIt goes into the next payout.
upheldNot paidThe engine cancels it and takes the money back. Already paid? Use a refund.

In the wild

Big programs ban it outright, and affiliate commission fraud has ended in prison.

  • Policy: Amazon's Associates rules prohibit buying products through your own Special Links, whether for yourself or anyone else. Source: Amazon Associates Participation Requirements, section 6(u), updated .
  • Related case: In 2014, eBay affiliate Shawn Hogan, paid more than $28 million in commissions, got 5 months in prison and a $25,000 fine for wire fraud. His scheme was cookie stuffing, not self-referral. Source: Wikipedia: Shawn Hogan.

Each item re-read against its linked source on . Items we couldn't verify were cut.

Limits, and how attackers try to beat it

  • A different email beats it. An affiliate who buys with a second address they own passes this rule.
  • Dots count on custom domains. jane.doe@yourco.com and janedoe@yourco.com stay different people.

The cheap dodge is a second inbox. When that inbox also signs up as an affiliate, the rule for one person running several accounts compares the two applications. When a group of affiliates trades purchases instead, buyer overlap across affiliates picks up the pattern.

Related rules

Thresholds checked against the code on . Windows roll with each sale.

Self-referral questions

Does it catch an affiliate using their partner's card?

No. It compares emails only. A purchase with a different email and a shared card passes this rule.

What if the affiliate is also a real customer?

That sale still holds, because the emails match. Release it in the fraud queue and it pays in the next payout.

When does the rule run?

On every credited sale, in the same database transaction as the credit. A sweep every 5 minutes also re-checks affiliates active in the last hour.

What does a hold cost me?

Nothing but time. A held commission stays out of payouts. Release it and it pays in the next payout. Uphold it and the engine cancels it and takes the money back.

Can I test it without holding anything?

Yes. Set AE_FRAUD_DRYRUN=1. The engine records each verdict and holds nothing.

Who wrote this

The AffiliateTracking team writes these pages from the engine's own code. Every threshold here is pinned by a test in the repository. Spot a mismatch? Tell us and we'll fix the page or the code.

This rule, on every sale,
before the payout.

Self-host for free, or let us run it for you.