Route outbound links through a referral endpoint where we have one - #4
Merged
Merged
Conversation
Adds Dedirock's referral link and the machinery to use it. The table of deals lives in packages/core/src/affiliates.js rather than in the providers table, because that table is a mirror: sync upserts it with coalesce(excluded.x, providers.x) on every column, so a referral URL stored there would arrive as null on each sync and survive only by the grace of that coalesce. In source it is reviewable in a diff, and a provider who is not in the catalogue yet is already wired up for the day they appear -- which is the case here, since nothing in the hosting collection names Dedirock today. The awkward part is that Dedirock's endpoint is WHMCS aff.php, measured on 2026-09-25: it answers 301 to https://dedirock.com, sets WHMCSAffiliateID for ninety days, and ignores both `url` and `goto`. Passing aff=960 inline on a billing page sets no cookie at all. So there is no way to earn the referral and land on a named plan. Rather than take the commission anyway, a landing-only link replaces a link to the provider's front door -- where nothing is lost, because that is where it lands regardless -- and never replaces a deep link to a particular offer. Dropping somebody who clicked a named plan onto a homepage to earn a commission is how a directory stops being worth reading. Every affiliate link is labelled where a reader can see it and carries rel="sponsored". Incidentally that is now accurate: the order button previously declared sponsored on every provider, paid or not. 20 tests for the substitution rule, the deep-link guard and the subdomain match (notdedirock.com must not borrow the deal). Full suite green at 59 pass / 2 skip. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Dedirock referral link Anthony supplied, plus the machinery to use it.
Where the table lives, and why not the database
packages/core/src/affiliates.js, not a column onproviders. That table is a mirror:syncupserts it withcoalesce(excluded.x, providers.x)on every column, so a referral URL stored there would arrive as null on each sync and survive only by the grace of that coalesce. In source it is reviewable in a diff, and a provider who is not in the catalogue yet is already wired up for the day they appear.That is the case here. Nothing in the NicheDB hosting collection names Dedirock today, so this link earns nothing until they are indexed. It is wired and waiting rather than live.
The landing-only problem
Dedirock's endpoint is WHMCS
aff.php. Measured 2026-09-25:It ignores
urlandgoto, and passingaff=960inline on a billing page sets no cookie at all. So there is no way to earn the referral and land on a named plan.Given that, a landing-only link replaces a link to the provider's front door — where nothing is lost, because that is where it lands regardless — and never replaces a deep link to a particular offer. Dropping somebody who clicked a named plan onto a homepage to earn a commission is how a directory stops being worth reading. A deep link simply earns nothing.
Disclosure
Every affiliate link is labelled
affiliatein the link itself and carriesrel="noopener nofollow sponsored". Incidentally that is now accurate: the order button previously declaredsponsoredon every provider, paid or not.Verification
notdedirock.commust not borrow the deal), empty-URL handling.sponsored+ the marker; Hetzner is byte-for-byte untouched.Outboundasservers.jsxcalls it: front door swapped, deep link left alone, no URL renders nothing.Not verified live — r4ck.dev is on dev2, which is currently down.
🤖 Generated with Claude Code