I tried to send event to Google Analytics 4 using the postman.
And GA4 just response 204 No Content and the event is not recorded in the data stream. I checked the measurement_id and api_secret has right value. Is there anything wrong?
Thank you.
I tried to send event to Google Analytics 4 using the postman.
And GA4 just response 204 No Content and the event is not recorded in the data stream. I checked the measurement_id and api_secret has right value. Is there anything wrong?
Thank you.
I encountered this issue today.
For me personally, it turns out I was looking for my received data in the wrong place: I was looking in Admin > Data Streams, which incorrectly told me "No data received in past 48 hours."
Where I actually needed to look was in the "Realtime Overview" (Reports > Realtime - see picture):
In there, there was a handy little event counter that showed me my events were, in fact, getting through just fine.
If you check here and it's still zero, here are some other things to try:
You may need to set the Content-Type header to "application/json".
Validate your events by sending them to the endpoint https://www.google-analytics.com/**debug**/mp/collect
rather than https://www.google-analytics.com/**debug**/mp/collect
- as long as you get "validationMessages": [] back, you should be good to go.
Make sure the JSON you're sending matches this format
According to the folks over at this similar StackOverflow question, You may need to set the User-Agent header, though I personally did not have to.
In my case, I try to use GA4 measurement protocol inside the Google Script. It took me quite a while to figure out.
In fact, the GA4 events are already created, only the users report is always empty. But I have to scroll down to see the events in the real time report.
And the reason the users are not showing, as well as the solution is mentioned in this post: Google Analytics 4 Measurement Protocol shows events but no users
Basically, one needs to put the engagement_time_msec
inside the event params
, in order for the user to show up in the real time report.
The object should be payload
, not body
.
Try to see this video: https://youtu.be/WSxdrG1G_yE