I designed a two-layer system that works entirely within the application boundary. On the frontend, a lightweight JavaScript class called CTracker intercepts UTM-style parameters (prefixed as c_source, c_medium, c_campaign) from the URL on first visit, then persists them in localStorage with a dual-slot model: one slot for the initial touchpoint, one for the most recent. No cookies, no external requests. On the backend, a chain of Django middleware - CTrackMiddleware followed by LeadSourceMiddleware - reads these parameters from query strings and session data, validates them, and writes them as LeadSource records in the database. When an anonymous visitor eventually signs up or logs in, a Django signal retroactively binds all stored attribution data to their user account, so nothing gets lost.