Open-source affiliate tracking: read the code that counts your commissions
Affiliates have always had to trust that a brand's tracking counts every sale they send. We publish the rules ViralPayouts runs in production so nobody has to: how a click, a coupon or an AI-agent checkout is tied to a partner, which signal wins when several disagree, and exactly how a recruiter's two-tier override is worked out and refunded.
It is the same code, with the same tests, that runs on viralpayouts.com. The repository is github.com/viralpayouts/viralpayouts.
- Open packages:
- 3.
- Open specs:
- 6.
- Platforms in the dataset:
- 535.
- Licences:
- MIT · AGPL · CC BY.
Updated · Who writes ViralPayouts
What is open
Everything that decides who earns and how much. Each part has its own licence, chosen so it can be used as widely as possible.
| Part | What it does | Licence |
|---|---|---|
@viralpayouts/trackingnpm install @viralpayouts/tracking | Sub IDs, partner coupon codes, where a click came from, the click-capture script for a brand’s site, postback URL checks and registrable domains. | MIT |
@viralpayouts/attributionnpm install @viralpayouts/attribution | The commission and two-tier override maths, refunds, rate rules, and attribution that survives AI assistants and agentic checkouts. | AGPL-3.0 |
@viralpayouts/mcpnpx -y @viralpayouts/mcp | An MCP server for Claude, Cursor, ChatGPT and other assistants: resolve attribution, work out commissions, check postbacks, detect agent clicks and search 535 affiliate platforms, offline. | MIT |
| Open tracking specs | The rules in plain language: attribution order, two-tier override, rate rules, sub IDs and coupons, postbacks, click capture. | CC BY 4.0 |
| Affiliate platform dataset | 535 affiliate, partner and referral platforms with pricing, payouts, tracking and two-tier support, every fact with its source. | CC BY 4.0 |
Why we opened it
Partners can check every sale
Brands can audit before they install
Agents prefer code they can read
Bugs are found sooner
Try it in a minute
Work out a two-tier commission
import { computeSplit } from '@viralpayouts/attribution/commission';
computeSplit(10000, {
rewardType: 'percent', directRateBps: 3000,
directFixedCents: 0, overrideBase: 'commission',
overrideRateBps: 1000, overrideFixedCents: 0,
}, true);
// { directCents: 3000, overrideCents: 300, ... }A $100 sale at 30%: the seller earns $30, and the person who recruited them earns $3 on top, never taken from the seller.
Add it to your AI assistant
{
"mcpServers": {
"viralpayouts": {
"command": "npx",
"args": ["-y", "@viralpayouts/mcp"]
}
}
}Then ask: “Which affiliate platforms pay partners for you and support two-tier?” It works offline, with no key.
What stays in the hosted service
We are open about what is not open, too.
Paying partners
Fraud and risk scoring
The partner network
Accounts and dashboards
That is what you pay for when ViralPayouts runs your program. See pricing.
Questions about the open-source code
- Can I self-host all of ViralPayouts?
- Not today. The tracking, attribution and commission rules are open and you can run them in your own stack. Payouts, the partner network and fraud scoring are part of the hosted service.
- Why is the attribution engine AGPL and the rest MIT?
- MIT lets anyone drop the tracking script and MCP server into anything. AGPL on the engine means anyone may use and change it, but a company that offers it as a hosted service must publish its changes, so improvements come back to everyone.
- Is this exactly the code you run?
- Yes. The open packages are the same modules and tests the live service uses. The only change is that our own platform fee is not in the open engine: you pass in your own fee rule, or none.
- How do I correct the platform dataset?
- Open an issue or pull request with a link to the platform's own page. Every record lists its sources. You can also browse it on compare tools.
Related pages
- Two-tier affiliate softwareWhat a second tier is, the split on a $100 sale, and who offers it from what price.
- Sub-affiliate softwareRecruit links kept apart from customer links, per-program overrides and refunds.
- Multi-level affiliate trackingWhy two levels is the right number, and what deeper chains cost a brand.
- Affiliate software with no monthly feeNo subscription: the fee table, and where a flat-price plan costs less.
- Pay-for-performance affiliate softwareYou pay on approved sales only, and refunds take the fee back.
- Stripe affiliate softwareThe webhook, the two metadata values, renewals and refunds.
- For recruitersHow recruiter overrides are earned and paid, per program.
- AEO bountiesPay partners a fixed bounty when their disclosed content gets you cited in AI answers.
- Best two-tier affiliate softwareEvery tool that offers a second tier, with prices, payouts and sources.
- State of affiliate software 2026What affiliate tools charge and offer, counted from their own pages, with the data.
- GlossarySub-affiliate, override, hold period, clawback and the rest, each with a worked number.