temelm
temelm

Reputation: 788

How to parse GA4 Measurement Protocol (collect?v=2) POST request URLs?

Objective

Problem

Upvotes: 0

Views: 899

Answers (1)

temelm
temelm

Reputation: 788

  • 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.
    • Example: postDataText.split(/\s+/)

Upvotes: 0

Related Questions