Sub topic 12
Validating Events with DebugView and Realtime Reports
This chapter assumes you can send e-commerce events with gtag.js or the GTM dataLayer, and that you know the items array and the currency and value parameters. Here you will check that those events arrive in GA4 with the right shape before you trust any revenue report.
Why validate before reading reports
Standard reports process data with a delay, and some reports can take 24 to 48 hours to settle. If a purchase event is wrong, you may not find out until the numbers look odd days later. GA4 gives you two tools that show events within seconds: DebugView and the Realtime report.
| Tool | Shows | Best for |
|---|---|---|
| DebugView | Events from one debug device, in order, with every parameter | Checking parameter names, values, and the items array |
| Realtime report | Events from all users in roughly the last 30 minutes | Confirming that live traffic sends events at all |
| Tag Assistant or GTM Preview | The tags that fired and the data they read | Finding why a tag did not fire |
Use them in that order of detail. DebugView answers "is this event correct?" and Realtime answers "is anything arriving?".
Turning on debug mode
DebugView only shows events from devices that are marked as debug devices. There are three common ways to do this.
- Install the Google Analytics Debugger Chrome extension and enable it. It adds debug information to every hit from that browser.
- Open GTM Preview mode (Tag Assistant). Preview mode marks the session as debug automatically.
- Add the
debug_modeparameter yourself.
For gtag.js, set debug_mode in the configuration so every event from that page is flagged:
gtag('config', 'G-XXXXXXXXXX', { debug_mode: true });You can also set it on a single event:
gtag('event', 'add_to_cart', {
debug_mode: true,
currency: 'USD',
value: 49.98,
items: [
{ item_id: 'SKU_1001', item_name: 'Trail Running Shoe', price: 24.99, quantity: 2 }
]
});In GTM, add a configuration field named debug_mode with the value true to the Google tag, or to a single GA4 event tag. Remove it before you publish to production, or at least confirm it is intended. Debug events are excluded from standard reports in some setups, so leaving the flag on for all visitors can hide real traffic from your reports.
Reading DebugView
Open the property in GA4, then go to Admin and choose DebugView (under Data display). Select your debug device from the device picker at the top left.
The center of the screen is a vertical timeline. Each dot is an event, grouped by the minute it was received. Click an event to see its parameters in the panel on the right. Events that are marked as key events appear with a flag.
For an e-commerce event, check these items in order:
- The event name matches the recommended name exactly, such as
add_to_cartand notaddToCart. currencyis a three-letter ISO 4217 code such asUSD.valueis a number, not a string like"49.98"and not a value with a currency symbol.- The
itemsparameter is present. Expand it to see each product. - Each item has
item_idoritem_name, pluspriceandquantity. - On
purchase,transaction_idis present and is the order number from your system.
If value is missing on add_to_cart, the event still arrives, but revenue-related reporting for that event will not have a value to use. DebugView shows what GA4 received, not what you meant to send, so it is the right place to catch this.
Checking the sequence
A funnel is only useful if events arrive in a sensible order. Walk through the shop as a tester and watch the timeline.
Look for these problems on the timeline:
- A missing step, such as
purchasewithoutbegin_checkout. A tag or trigger is probably not set up on that page. - The same event twice in a row. A listener may be attached twice, or both a hard-coded tag and a GTM tag fire.
- A
purchasethat appears again when you reload the confirmation page. The page lacks protection against resends, and GA4 may count revenue twice for the same order unless it de-duplicates bytransaction_id.
Using the Realtime report
Go to Reports and open Realtime. It shows users in the last 30 minutes, the events they triggered, and cards such as "Event count by Event name". Click an event name to filter the cards to that event.
Realtime is less detailed than DebugView. It does not show the full items array for each hit. Use it to answer questions like these:
- Did
purchaseevents arrive at all after a release? - Is the count of
add_to_cartevents plausible next to the number of active users? - Do events from a different country or device type look wrong?
Realtime also includes debug traffic from your own tests, so a spike may be your own clicking. Use the comparison and filter options, or test in a quiet period.
Validating in the browser first
Before you open GA4, you can inspect the data on the page. In a GTM setup, run this in the browser console to see everything pushed so far:
console.log(JSON.stringify(window.dataLayer, null, 2));Look for the e-commerce push and compare it to the recommended shape. In the browser's network tab, filter requests by collect. A request to google-analytics.com/g/collect carries the event name as en and the measurement ID as tid. A status of 204 means the hit was accepted by the endpoint, though that only confirms delivery and does not confirm the data is correct.
Common validation traps
- No debug device appears. The extension is off, an ad blocker removes the request, or the measurement ID points to another property.
- Events appear in DebugView but not in reports. Standard reports lag, and filters or data-quality settings can exclude traffic. Wait, then check again.
- Realtime shows the event but the revenue is zero. The
valueis missing, a string, orcurrencyis absent. Open the event in DebugView and check the types. - Items show as
(not set)later. An item parameter name has a typo, such asitemIdinstead ofitem_id. DebugView shows the parameter under the wrong name. - Test orders pollute data. Test purchases made in production count as real revenue. Use a test
transaction_idprefix, filter by a test parameter, or use a separate test property.
A short test checklist
- Enable debug mode on one browser.
- Walk the whole funnel from list to purchase.
- Inspect each event in DebugView against the six checks above.
- Reload the confirmation page and confirm the purchase is not sent twice.
- Confirm the same events appear in Realtime.
- Disable debug mode and remove test data from your plan for reports.
Exercise
In DebugView you see a purchase event with value shown as the text "49.98" and no currency. Realtime counts the event, but revenue in reports is zero. What is wrong and how do you fix it?
Show answer
GA4 needs value as a number and currency as a three-letter code to treat the amount as revenue. Change the code to send value: 49.98 (a number) and add currency: 'USD', then repeat the test in DebugView and confirm the types are correct.
Exercise
You reload the order confirmation page and DebugView shows a second purchase event with the same transaction_id. Why is this a risk and what should you do?
Show answer
Each resend can add the same order to revenue unless GA4 de-duplicates it, and de-duplication is not something to rely on. Guard the tag so it fires once per order, for example by storing the sent transaction_id in a cookie or local storage and skipping the event if it is already stored.