Carry what only the HTTP request knows into the LiveView socket.
# router.ex, in the :browser pipeline, after fetch_session
plug Pixelex.Plug.SessionWhy this is necessary
A LiveView's WebSocket has no Referer header. It is sent once, on the
initial HTTP request, and never again. Without somewhere to put it, every
LiveView visit after the first render is attributed to direct traffic and
the whole attribution story collapses for exactly the apps this library is
built for.
The same is true of the CDN's country header and the consent decision. The session is the one place both the request and the socket can see.
Written once per session rather than on every request: the values describe how this visitor arrived, and overwriting the referrer on their fourth page would replace "came from a Google ad" with "came from our own pricing page".