Sub topic 3
Realtime or DebugView: which one to use
This chapter assumes you know the GA4 Admin area, understand events, parameters and user properties, and have editor access to a property with a web or app data stream. You also need access to the site or app code if you plan to test changes.
Choosing between Realtime and DebugView
Use the Realtime report to confirm that data is arriving at all. Use DebugView to inspect what a single test device sends, parameter by parameter.
| Task | Use |
|---|---|
| Confirm that any traffic is arriving | Realtime report |
| Check event names and counts over the last 30 minutes | Realtime report |
| Inspect parameters and user properties for one device | DebugView |
| Test a newly deployed event | DebugView |
A step-by-step verification workflow
- Open Realtime and generate one page view. Confirm that the user count changes.
- Turn on debug mode for your test browser or device (see the earlier chapter).
- Open DebugView, select your debug device, and trigger the event.
- Check the event name, required parameters and user properties.
- Return to Realtime to confirm the event count rises.
Keeping developer and test traffic out of your reports
Test traffic inflates reports. In Admin > Data settings > Data filters, create a filter for the Developer traffic type and set it to Active after testing. Debug events are still visible in DebugView while the filter is in Testing state.
> Note: Turn off debug mode in production code. Leaving debug_mode on sends real visitors' events to DebugView.
Troubleshooting: why events do not show up
- The event is not sent. Check the browser network tab or the device log.
- The measurement ID is wrong. Compare it with the data stream ID.
- The debug device is not selected in DebugView.
- The event is delayed. Standard reports can take hours, while Realtime and DebugView usually update within a minute.
- Developer traffic filters hide the events in reports.
Querying recent activity with the Realtime Reporting API
Use the Realtime Reporting API to check event counts from a script. Replace PROPERTY_ID and ACCESS_TOKEN with your values.
curl -X POST "https://analyticsdata.googleapis.com/v1beta/properties/PROPERTY_ID:runRealtimeReport" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"dimensions": [{ "name": "eventName" }],
"metrics": [{ "name": "eventCount" }]
}'Debugging Measurement Protocol events
The Measurement Protocol sends events directly from a server. Send a test payload to the debug endpoint. It validates the payload and returns validationMessages without recording the event.
curl -X POST "https://www.google-analytics.com/debug/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=YOUR_API_SECRET" \
-H "Content-Type: application/json" \
-d '{
"client_id": "test.1234567890",
"events": [{
"name": "sign_up",
"params": { "method": "email" }
}]
}'An empty validationMessages list means the payload is valid. Once it is valid, send the same event to the regular collection endpoint so it appears in DebugView.
Exercise
Exercise
A new purchase event does not appear in the standard reports one day later. Which tool do you use first to check whether the event arrives, and why?
Show answer
Use the Realtime report or DebugView first. Standard reports can lag by hours, so Realtime or DebugView shows whether the event reaches GA4 at all. DebugView also shows the parameters for the test device.