Sub topic 7
Checking your data in DebugView
This chapter assumes you can find Admin in a GA4 property, know what a data stream is, and can send an event with gtag.js or Google Tag Manager (GTM). You will use DebugView to confirm that event parameters, user properties and item parameters arrive as intended. You do this before you register them as custom dimensions or metrics.
What DebugView proves
DebugView is a GA4 report that shows events from individual devices as they arrive, within seconds. You find it in Admin, under Data display, then DebugView. Standard reports can take hours to update, so DebugView is where you test a change.
DebugView shows every parameter and user property that reaches GA4. It does this whether or not you registered a custom definition. That gives it a specific role:
- It proves the data was sent: the event name, the parameter name, the value and its type.
- It does not prove the data will show up in reports. Reports need a registered custom dimension or metric, and registration has its own delay.
Check collection first. Then register. If a parameter is missing from DebugView, registering it cannot fix anything.
Turning on debug mode
DebugView shows only traffic from devices in debug mode. Each method below marks events with a debug_mode flag.
gtag.js
Set debug_mode in the configuration for the stream. Every event from that page then carries the flag.
gtag('config', 'G-XXXXXXXXXX', {
debug_mode: true
});
gtag('event', 'select_plan', {
plan_tier: 'pro',
billing_cycle: 'annual'
});You can also set debug_mode: true on a single event. That is useful when you want to test one interaction and keep the rest of the traffic normal.
Google Tag Manager
Opening GTM Preview (Tag Assistant) turns on debug mode for the previewed session. Your GA4 tags then send debug traffic without any code change. To debug outside Preview, add a debug_mode field set to true in the fields to set of the Google tag or the GA4 event tag. Remove it before you publish a container for general use.
Browser extension and apps
The Google Analytics Debugger Chrome extension turns on debug mode for any page you visit. For Android apps that use Firebase, you enable debug mode on a device or emulator with an adb command. Check the Firebase documentation for the current command for your SDK.
Measurement Protocol
Server-side events do not come from a browser, so you add the flag to the request yourself. Include debug_mode in the event params. Send the request to the /debug/mp/collect endpoint to get validation messages back. That endpoint only validates the request. It stores nothing and sends nothing to DebugView.
curl -X POST \
"https://www.google-analytics.com/debug/mp/collect?measurement_id=G-XXXXXXXXXX&api_secret=YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{
"client_id": "555.1234567890",
"events": [{
"name": "offline_sale",
"params": { "store_region": "north", "basket_size": 4 }
}]
}'A clean request returns an empty validationMessages array. Each message names the field that failed. After the request validates, send it to the normal /mp/collect endpoint with debug_mode in the params. Then look for it in DebugView.
Reading the DebugView screen
The screen has three parts:
- A device selector at the top. Pick your debug device. If the list is empty, no debug traffic has arrived in the last 30 minutes.
- A timeline in the center. The left side groups events by minute. The right side shows the same events second by second. Click an event to open its parameters.
- A right-hand panel with top events and the user properties set on the selected device.
DebugView shows only about the last 30 minutes. Test in one sitting, and re-trigger the event if it scrolls out of view.
What to check for each scope
| Scope | Where to look | What to confirm |
|---|---|---|
| Event | Parameters list of the selected event | Parameter name spelled exactly as planned, value correct, type correct |
| User | User properties panel | Property name and value appear. They are attached to the events that follow |
| Item | The `items` entry inside an ecommerce event | The custom item parameter sits inside the item object, not at the top level of the event |
| Metric (event-scoped) | Parameters list of the selected event | The value is a number, not a quoted string, and uses the unit you plan to choose |
Names and values
Parameter names are case-sensitive. Plan_Tier and plan_tier are two different parameters. When you later register the dimension, the parameter name must match what you see here character for character.
Check the value limits as well. An event parameter name can have at most 40 characters and its value at most 100. A user property name can have at most 24 characters and its value at most 36. Longer values are truncated or dropped. Test the longest realistic value, not only a short one.
Numbers and strings
DebugView displays a number and a numeric string similarly. Look closely at the code instead. video_length_seconds: 184 is a number. video_length_seconds: '184' is a string. A custom metric needs a numeric value, so a string value can leave the metric empty. Make sure the sending code passes a real number.
User properties arrive later than you expect
A user property set with gtag('set', 'user_properties', ...) is attached to events sent after the call. It is not sent on its own. Trigger another event after setting it, then check the right-hand panel.
gtag('set', 'user_properties', {
customer_type: 'subscriber'
});
gtag('event', 'select_plan', {
plan_tier: 'pro',
billing_cycle: 'annual'
});Troubleshooting what you do not see
The diagram shows the order to follow when a value is missing from DebugView.
The most common causes at each step:
- No device in the selector.
debug_modeis not set, the page uses a different Measurement ID than the property you are viewing, an ad blocker is stopping the request, or consent settings block analytics storage. - Event missing. The trigger did not fire, or the event name has a typo.
- Parameter missing. In GTM, the parameter is not added to the event tag, or the data layer variable has the wrong name or reads
undefined. In gtag.js, the parameter sits outside the event's parameter object. - Item parameter missing. The custom field is on the event instead of inside the object in the
itemsarray.
Debug traffic and your reports
Events in debug mode are real events in the property. Whether they appear in standard reports depends on your data filters. GA4 has a Developer traffic filter, under Admin, then Data collection and modification, then Data filters. When it is active, it excludes events that carry the debug flag from reports. DebugView still shows them. The filter starts in a Testing state and does nothing until someone sets it to Active.
This matters when you test. If you see your test events in reports, the filter is not active. If you cannot find them there but they appear in DebugView, the filter is probably working. Either way, do not use debug sessions to judge report numbers.
A pre-registration checklist
Run through this list for each new custom definition before you open Admin:
- The event appears with its exact intended name.
- The parameter or user property appears with the exact name you will register.
- The value is what you expect in at least two different situations, for example two plan tiers.
- Numeric values are numbers, for a metric.
- Values are within the length limits and contain no personal data.
- For items, the field appears inside each object of the
itemsarray.
Repeat the test with a second value. A parameter that always shows one hard-coded value passes a single check and still fails later.
Exercise
You added gtag('set', 'user_properties', { customer_type: 'subscriber' }) and opened DebugView, but the User properties panel is empty and no event has fired since the call. What should you do, and why?
Show answer
Trigger another event, for example select_plan, after the set call and reselect your debug device. A user property is attached to events sent after it is set, so it appears in DebugView only after a later event arrives. Also confirm that debug_mode is on for that page.
Exercise
A teammate sends video_length_seconds: '184' in a video_complete event and plans to register it as a custom metric. DebugView shows the event and the parameter. What is the risk, and how do you fix it?
Show answer
The value is a string, not a number, so a custom metric built on it may stay empty. DebugView showing the parameter only proves it was collected. Fix the sending code to pass 184 as a number, retest in DebugView, and then register the metric.