- Shipped
- September 6, 2026 at 2:57 AM UTC
- Author
- Kamo
- Commit
- 61bfffb
Two ways a member's referral was being dropped, both silent. 1. Every register/login CTA was the string literal `https://register.kamocrm.com`, while this site is served to every tenant off one build (`HostRegexp(^www[.].+$)`, tenant resolved at runtime from the hostname). On `www.acme.com` those links crossed to a different registrable domain, so the browser did not send kdsc_vid or kdsc_src, RegisterFlow read no attribution, and the signup also landed under the wrong organisation. The ~200 routes are prerendered and their HTML is the same bytes for every tenant, so the href cannot be tenant-correct in the markup: AuthLinkRehost fixes it on the client, eagerly, and also carries the code in the URL so attribution survives a cookie hop that never happens. 2. DiscountBeacon lived in the idle-loaded ChromeBundle, behind an idle wait, a chunk fetch and a second idle wait — ~2.4s on the homepage at 4x CPU throttle, with "Start Free" above the fold. Its first request is the ONLY thing that creates a MARKETING_VISITORS row, and every later conversion is a conditional UPDATE against that row, so a visitor who clicked before it fired was never recorded and their signup, org and first payment were credited to nobody, permanently. It is mounted eagerly now and sends the first pageview directly; later navigations stay on the idle queue. Measured: beacon at +2,580ms vs +3,151ms for the earliest the old arrangement could even mount it. Both are guarded: check-register-links.ts asserts the rehosted host is one the referral cookie is actually sent to (same apex rule as trackingCookieDomain), and check-discount-cookie.ts now fails the build if the beacon moves back into the deferred bundle. 187 routes still prerendered, all 6 sentinels intact.