HomeBlogHow a stale session broke affiliate attribution —...

How a stale session broke affiliate attribution — and what we fixed

Engineering Team 21 May 2026 1 min read

Last week we found that our affiliate tracking endpoint was logging clicks correctly but failing to attribute purchases. The cause was subtle: server-side session held the affiliate code, but the purchase flow read from a cookie that was never set.

Two-line fix in AffiliateController@track: set the mp_aff cookie alongside the session. Now attribution survives across browser restarts and incognito sessions.

The lesson: end-to-end test attribution chains in production-like conditions. Unit tests that mock the session pass even when the real flow is broken.

Run your coaching institute on CoachPlus.

10,000+ institutes. Fees, batches, live classes, parent app — in one platform.

Start 14-day free trial →

Reading the AMP version. View the full article with table of contents →