Reputation: 21
I'm using GA4 Measurement Protocol to record events from a Roku application. This is not a web or Android/iOS app and there's no SDK for GA4, so I need to record events the same way I would do from a server: HTTP requests using the Measurement Protocol as if I had a gtag installed in my app.
If I go to Reports > Tech > Tech overview
in my property's dashboard I see metrics like:
I don't know how to populate these values using GA4's Measurement Protocol. So far my requests look like this
POST /mp/collect HTTP/1.1
HOST: www.google-analytics.com
Content-Type: application/json
Query params:
api_secret: XXXX
measurement_id: XXXX
Request body
{
"client_id": "some random id because i don't actually have a gtag to generate it",
"user_id": "a unique id generated by the device",
"non_personalized_ads": false,
"user_properties": {
"device_id": {
"value": "same as user_id, just to have it as a user property"
}
},
"events": [
{
"name": "custom_event1",
"params": {
"engagement_time_msec": "1", // need to have this as > 0 otherwise it GA4 won't show the user
"session_id": "another random id generated by the device so that i can start a session",
"param1": "xyz"
}
}
]
}
For populating the Users by OS table, I read in other posts that I should use the ua
query param, but it's not working for me with this value, which is what I send to my backend: Roku/DVP-11.0 (11.0.0.4184-AE)
Upvotes: 2
Views: 710