I do not want to put any company's GA4 tracking/measurement ID on Stack Overflow. Hence, to see an example POST request I am trying to parse: 1. Open DevTools => 2. Select Network tab => 3. Filter by collect?v=2 => 4. Visit https://www.ocado.com/search?entry=nutella => 5. Slightly scroll down
You should be able to see a network hit with both query string parameters and request payload.
I am trying parse this data and display it nicely to assist debugging.
This problem causes the data displayed to be incomplete / incorrect.
Solution
Standalone GA4 hits are POST requests with query string parameters.
Batched GA4 hits are POST requests with query string parameters and payload.
Splitting payload text by one or more whitespace characters will return an array of strings where each string represents the data associated with a batched GA4 event.