I'm tracking users on my website using GA4 (client-side) and sending purchase events via the Measurement Protocol API (server-side).
However, nearly half of the purchases appear under the "Unassigned" traffic channel in GA4 reports.
I extract client_id and session_id from cookies (_ga and _ga_session) and pass them via cURL to a PHP script. The PHP script sends a purchase event to GA4 using the Measurement Protocol API.
It seems GA4 is unable to associate these conversions with their original traffic source.
How can I ensure my purchase events are correctly attributed to the original traffic source in GA4?