Raxx · internal docs

internal · gated ↑ index

ADR 0018 — Founders Referral: cookie-primary attribution with URL-param fallback

Status: Proposed Date: 2026-04-23 Deciders: software-architect Related: docs/architecture/founders-referral-service.md §5 Parent card: #207


Context

When a visitor follows a Founder's referral link (/r/{slug}), Raptor must attribute that visit to the correct Founder's link so that if the visitor later signs up and converts to a paid subscription, the correct Founder receives the bonus. The attribution window is 30 days.

The core tension: cookies are the simplest server-side attribution mechanism, but they have GDPR constraints in the EU (functional cookies require disclosure; tracking cookies require consent under ePrivacy Directive) and are ephemeral under browser ICP (Intelligent Tracking Prevention), private-browsing mode, and aggressive cookie-blocking settings.

Four approaches were evaluated:

  1. Cookie only
  2. URL parameter only (pass-through to signup form)
  3. Cookie primary, URL parameter fallback
  4. Server-side session / IP-based fingerprinting

Decision

Cookie primary (raxx_ref={slug}), URL parameter fallback (?ref={slug}), with a GDPR consent gate for EU visitors on the cookie drop.

Cookie spec: - Name: raxx_ref - Value: slug (8 chars, no PII) - Max-Age: 2592000 (30 days) - SameSite=Lax - Secure - HttpOnly

GDPR gate: For visitors where the consent management platform (CMP) reports the user is in the EU and has not consented to functional cookies: do NOT set the cookie. Instead, include ?ref={slug} in the redirect URL. The signup flow reads ?ref as a form parameter if the cookie is absent.

Attribution read order at signup: 1. Check raxx_ref cookie. If present, use slug from cookie. 2. Else check ref query parameter (passed through the signup URL or hidden form field). 3. Else: no attribution; user is direct_signup cohort.


Consequences

Positive

Negative


Alternatives considered

Simple. Rejected because it silently drops attribution for private-browsing and strict-cookie users with no recovery path.

Every redirect would carry ?ref={slug} through the entire signup flow as a form field or URL parameter. This is more fragile: if the user navigates away from the signup page and returns via bookmark (without the param), attribution is lost. Cookies are more durable for multi-step signup flows. Rejected as primary; retained as fallback.

Server-side fingerprinting (IP + User-Agent hashing)

Associates the click with an IP+UA hash, then matches at signup time. Rejected for v1 because: - IP hashing is PII under GDPR (recital 49, recital 26 — identifiable via ISP). Adds a new PII surface requiring explicit consent and retention policy. - Carrier-grade NAT means multiple users can share an IP; false attributions are possible. - The complexity is disproportionate to the v1 cohort size. - Flagged as a v2 enhancement if attribution miss rate proves significant from PostHog data (#214).

localStorage / sessionStorage

JavaScript-accessible, not HttpOnly. Rejected because it requires client-side JS to execute before attribution is recorded, which is not possible server-side on the redirect. Also not accessible to the server without an additional API call, complicating the attribution read at signup.


Revisit when