Sub topic 11
Checking events in DebugView and preview mode
What you need before you start
This chapter assumes you can already send events with gtag.js or a Google Tag Manager (GTM) GA4 event tag. It also assumes you can open a GA4 property and a GTM container. Here you will check that those events arrive with the names and parameters you planned. Registering parameters for reports is covered in a later chapter.
Why validate before you publish
An event can fail in several quiet ways. The tag may never fire. The event name may have a typo. A parameter may be missing or arrive as text when you meant a number. Standard reports show data with a delay, so they are a poor place to find these problems. Two tools show events as they arrive:
- Tag Assistant preview mode in GTM shows what your container did on the page. It shows which tags fired, which triggers matched, and what the data layer held.
- DebugView in GA4 shows what GA4 received. It lists events, parameters, and user properties for a single device, in near real time.
The two tools answer different questions. Preview mode asks "did my container send the right thing?" DebugView asks "did GA4 accept it, and what does it look like?" Use both, in that order.
Checking the container in Tag Assistant preview
Preview mode applies to GTM only. If you use gtag.js directly, skip to the DebugView sections.
- Open your container in Tag Manager and click Preview.
- Enter the URL of the site you want to test and connect. The site opens in a new tab with a debugger attached.
- Perform the action you want to measure, such as completing a tutorial.
- In the Tag Assistant summary, select the matching entry in the left-hand list. For a data layer push, the entry is named after the
eventvalue, for exampletutorial_complete. - Check the Tags tab. Your GA4 event tag should be under Tags Fired, not Tags Not Fired.
- Check the Data Layer tab to confirm the keys and values that were pushed.
Take the push from earlier chapters as the example:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'tutorial_complete',
tutorial_id: 'ga4-events-101'
});In preview mode, a message named tutorial_complete should appear. Its Data Layer tab should show tutorial_id with the value ga4-events-101. If the message is missing, the page code never ran the push. If the message appears but the tag is under Tags Not Fired, open the tag and look at its trigger. Tag Assistant lists each trigger condition and marks which ones passed.
Preview mode also sends your test traffic to GA4 in debug mode, so what you see here connects directly to DebugView.
Turning on DebugView
DebugView only shows events that are marked as debug events. There are several ways to mark them.
| Method | When to use it |
|---|---|
| GTM preview mode | Your site uses GTM. Debug mode is turned on for you. |
| Google Analytics Debugger browser extension | Your site uses gtag.js and you want a quick toggle in Chrome. |
| `debug_mode` parameter in the code | You need debugging on a specific page or in a specific environment. |
For gtag.js, set debug_mode on the configuration call:
gtag('config', 'G-XXXXXXXXXX', {
debug_mode: true
});You can also add it to a single event:
gtag('event', 'newsletter_signup_click', {
placement: 'footer',
plan_type: 'free',
debug_mode: true
});Remove debug_mode before you publish. Debug events do not appear in standard reports. If you leave the flag on in production, those users' events will be missing from your reporting.
Reading DebugView
Open DebugView in GA4 under Admin, in the Data display section. The path can differ slightly between interface versions. If you do not see it, search for "DebugView" in the property's search bar.
- At the top, pick the device from the Debug Device menu. DebugView shows one device at a time. If several people are testing, you may need to choose the right one.
- The central stream lists events by minute. Each bubble is an event, and the number on a bubble counts how many times the event occurred in that minute.
- Click an event to see its parameters on the right. Parameters appear with their values. Numeric values and text values are shown differently, which helps you spot a number sent as a string.
- Click the User properties card to see what was set for the user.
- Events marked as key events display a flag icon.
Walk through a test. Send the purchase event from the earlier chapter and open it in DebugView. Check these items:
- The event name is exactly
purchase. transaction_idisT_12345.valueis59.98andcurrencyisUSD.- The
itemsarray holds one item, withitem_idSKU_123andquantity2.
If value is shown as text, your code probably passed "59.98" in quotes. Fix it in the code, not in the report.
Common problems and what they mean
| Symptom | Likely cause | What to check |
|---|---|---|
| Nothing in DebugView | Debug mode is off, or the wrong device is selected | Confirm preview mode or `debug_mode`. Pick the device in the menu. |
| Event shows in preview, not in DebugView | The tag fired with the wrong Measurement ID, or a blocker stopped the hit | Compare the ID in the tag with the data stream. Disable ad blockers for the test. |
| Tag is under Tags Not Fired | The trigger conditions did not match | Open the trigger in Tag Assistant and read which condition failed. |
| Event name looks wrong | Typo or capital letters in the name | Event names are case-sensitive. `Sign_Up` and `sign_up` are different events. |
| Parameter is missing | Typo in the key, or the variable is empty in GTM | Compare the key with the tracking plan. Check the data layer variable in the Variables tab. |
| Event fires twice | The tag has two triggers, or the push runs twice | Look for two entries in preview mode. Review the trigger list on the tag. |
| Event appears in DebugView but not in reports | Debug traffic is excluded, or processing is delayed | Wait for processing, then check with non-debug traffic. |
A related point causes confusion. DebugView shows every parameter you send. A standard report shows only parameters you registered as custom dimensions or metrics. A parameter that appears in DebugView but not in a report is usually not registered yet. That is the subject of the next chapter.
Using the Realtime report as a second check
The Realtime report shows non-debug traffic from the last 30 minutes. It is useful for confirming that events reach production after you publish. It shows event names and counts, but it does not show individual parameter values the way DebugView does. Treat it as a smoke test, and DebugView as the detailed inspection.
A repeatable validation routine
Use the same steps for each event in your tracking plan.
- Start preview mode, or enable
debug_mode. - Trigger the action once.
- Confirm the container fired the tag (preview mode) and the data layer held the expected keys.
- Open DebugView and select your device.
- Check the event name, then each parameter name and value, against the plan.
- Trigger the unwanted cases, such as the action failing or repeating, and confirm nothing extra is sent.
- Publish the container, remove debug flags, and check the Realtime report.
Step 6 catches the most expensive mistakes. A purchase event that fires on every page reload, for example, inflates revenue.
Exercise
You push tutorial_complete to the data layer. Tag Assistant shows the message, but the GA4 event tag is listed under Tags Not Fired, and DebugView shows nothing. Where do you look first, and why?
Show answer
Look at the tag's trigger in Tag Assistant. The data layer push worked, because the message appears, so the problem is that the trigger conditions did not match. Tag Assistant shows each condition and whether it passed. A common cause is a Custom Event trigger whose event name differs from tutorial_complete, for example by case. DebugView is empty because the tag never fired, so no hit was sent.
Exercise
A teammate sees value in DebugView on a purchase event as the text "59.98". What went wrong, and where is the fix?
Show answer
The code passed the value as a string in quotes instead of a number. Fix it where the event is sent, by passing 59.98 as a number, and test again in DebugView. Changing a report cannot repair how the value was sent.