You have successfully implemented server-side tracking using Node.js and the Google Analytics 4 (GA4) Measurement Protocol. Your events are arriving in the dashboard, and your revenue numbers match your backend database. However, when you check the Traffic Acquisition report, those server-side conversion events fall into the black hole of (not set) , Unassigned , or Direct . Your "Purchase" events are disconnected from the "Session Start" events that occurred in the browser. Consequently, you cannot attribute revenue to the Google Ads campaign, SEO landing page, or email newsletter that drove the sale. This guide provides the architectural root cause and a production-ready Node.js solution to stitch server-side events back to the original client-side session. The Root Cause: Missing Session Context To understand why attribution fails, you must understand how GA4 defines a "Session." When a user visits your site, gtag.js (the client-side l...
Practical programming blog with step-by-step tutorials, production-ready code, performance and security tips, and API/AI integration guides. Coverage: Next.js, React, Angular, Node.js, Python, Java, .NET, SQL/NoSQL, GraphQL, Docker, Kubernetes, CI/CD, cloud (Amazon AWS, Microsoft Azure, Google Cloud) and AI APIs (OpenAI, ChatGPT, Anthropic, Claude, DeepSeek, Google Gemini, Qwen AI, Perplexity AI. Grok AI, Meta AI). Fast, high-value solutions for developers.