10 KiB
Complete DebugView Guide
Enabling Debug Mode
Method 1: Google Analytics Debugger Extension (Recommended)
Installation:
- Open Chrome Web Store
- Search "Google Analytics Debugger"
- Install extension
- Click extension icon to enable (icon turns blue)
- Reload website
Benefits:
- Easiest method
- Works immediately
- No code changes needed
- Toggle on/off easily
Method 2: URL Parameter
Add ?debug_mode=true to any URL:
https://example.com/products?debug_mode=true
Limitations:
- Only debugs pages with parameter
- Lost on navigation (unless preserved)
- Must add to each test URL
Method 3: gtag.js Code
Add to gtag.js configuration:
gtag('config', 'G-XXXXXXXXXX', {
'debug_mode': true
});
Important: Remove before production!
Method 4: Google Tag Manager
In GA4 Configuration tag:
- Expand Configuration Settings
- Add parameter:
- Name:
debug_mode - Value:
true
- Name:
OR use conditional debug mode:
debug_mode: {{Debug Mode Variable}}
Create variable that returns true in test environments only.
DebugView Interface
Main Components
1. Device Stream (Left Sidebar)
Shows active debug sessions:
- Device icon: Desktop/Mobile/Tablet
- User identifier: user_pseudo_id or user_id
- Session timing: How long ago session started
- Event count: Total events in session
Click device to see its event stream.
2. Event Stream (Center Panel)
Lists all events chronologically:
- Event name: (e.g., page_view, purchase)
- Timestamp: When event fired
- Event icon: Visual indicator by type
- Event count badge: Times this event fired
Color coding:
- Blue: Standard events
- Purple: E-commerce events
- Orange: Custom events
3. Event Details (Right Panel)
When event selected, shows:
Event Parameters:
- All parameters sent with event
- Parameter names and values
- Data types indicated
User Properties:
- Properties set at user level
- Persist across events
- Show value and set time
Device & Geo:
- Device category, brand, model
- Operating system, browser
- Country, region, city
Event Context:
- Event timestamp (precise)
- Session ID
- Event count in session
Interpreting Events
Automatic Events
session_start
- Fires: First event in new session
- Parameters:
session_id: Unique session identifierga_session_id: Session timestampengagement_time_msec: 0 (initial)
first_visit
- Fires: Only for brand new users
- Indicates: First time user visits site
- Parameters: Basic device/geo info
page_view
- Fires: Every page load (automatic with GA4 config)
- Parameters:
page_location: Full URLpage_referrer: Previous page URLpage_title: Document titleengagement_time_msec: Engagement time
user_engagement
- Fires: When user actively engages (1 second foreground)
- Parameters:
engagement_time_msec: Total engagement time
Recommended Events
purchase
Required Parameters:
transaction_id: Unique order IDvalue: Total revenue (number)currency: 3-letter ISO codeitems: Array of purchased items
Optional Parameters:
tax: Tax amountshipping: Shipping costcoupon: Coupon code used
Item Structure (in items array):
{
"item_id": "SKU_123",
"item_name": "Blue T-Shirt",
"price": 29.99,
"quantity": 1,
"item_category": "Apparel",
"item_brand": "MyBrand"
}
add_to_cart
Required:
currency: "USD", "EUR", etc.value: Item valueitems: Array with item details
begin_checkout
Required:
currency: Currency codevalue: Cart totalitems: Items array
Custom Events
Identification:
- Event name not in Google's recommended list
- Typically follows business-specific naming
- Should use snake_case convention
Validation:
- Name ≤40 characters
- Lowercase with underscores
- Descriptive parameters
- Correct data types
Validation Checklists
Page View Validation
page_viewfires on every page loadpage_locationcontains full URLpage_titlematches document.titlepage_referrershows previous page (if applicable)engagement_time_msecincreases over time
E-commerce Validation
For purchase Event:
transaction_idis unique stringvalueis number (not string "99.99")currencyis 3-letter code (USD, EUR, GBP)itemsis array (not empty)- Each item has
item_idanditem_name - Item
priceis number - Item
quantityis integer - Total matches sum of items
- No duplicate
transaction_idin session
For add_to_cart Event:
- Fires when user adds item
itemsarray populated correctlyvalueandcurrencypresent- Item details match product added
User Properties Validation
- Properties appear in User Properties section
- Properties persist across multiple events
- Property values correct type
- No PII (email, name, address)
- Custom properties prefixed appropriately
Custom Dimensions Validation
- Custom dimensions appear as event parameters
- Values populate correctly
- Data type matches configuration in GA4
- Dimension name matches Admin setup exactly (case-sensitive)
Troubleshooting
Events Not Appearing in DebugView
Checklist:
-
Debug mode enabled?
- Chrome extension active (icon blue)
- URL has
?debug_mode=true - gtag debug_mode set to true
-
Correct property selected?
- Check property ID in top-left dropdown
- Verify Measurement ID in code matches
-
Events recent?
- DebugView shows last 30 minutes only
- Reload page to send new events
-
Tracking blocked?
- Disable ad blockers
- Check browser privacy settings
- Try incognito mode
-
Implementation correct?
- Measurement ID format: G-XXXXXXXXXX
- gtag.js or GTM installed correctly
- No JavaScript errors blocking execution
Missing Event Parameters
Causes & Solutions:
Cause: Parameter not sent from code
- Solution: Check dataLayer push includes parameter
- Solution: Verify GTM variable populated
Cause: Variable undefined in GTM
- Solution: Check Data Layer Variable configuration
- Solution: Verify data layer key spelling (case-sensitive)
Cause: Parameter name typo
- Solution: Check parameter name matches exactly
- Solution: Use consistent naming (snake_case)
Cause: Empty value filtered out
- Solution: Ensure variable has value before event fires
- Solution: Set default value if appropriate
Wrong Data Types
Issue: String instead of number
Example:
// WRONG
'value': '99.99' // String
// CORRECT
'value': 99.99 // Number
Detection in DebugView:
- Parameter value appears in quotes: "99.99" (string)
- No quotes: 99.99 (number)
Fix:
- Use
parseInt()orparseFloat()in JavaScript - Remove quotes from literal values
- Check GTM variable format
Duplicate Events
Causes:
-
Multiple tags firing
- Check GTM for duplicate tags
- Review trigger conditions
-
Both gtag.js and GTM
- Remove gtag.js if using GTM
- Use only one implementation method
-
Trigger firing multiple times
- Check trigger limits in GTM
- Use "Once per Event" firing option
-
Multiple dataLayer pushes
- Review JavaScript for duplicate push calls
- Check SPA route change handling
Testing Workflows
Complete Implementation Test
Steps:
-
Enable debug mode (Chrome extension)
-
Open DebugView (GA4 Admin → DebugView)
-
Clear browser cache and cookies
-
Open website in incognito/private mode
-
Verify first-time user events:
first_visitfiressession_startfirespage_viewfires- All parameters present
-
Navigate to second page
page_viewfirespage_referrershows previous page- Session ID consistent
-
Test custom events
- Trigger each custom event
- Verify event name correct
- Check all parameters present
- Validate parameter values
-
Test e-commerce flow (if applicable)
- View product →
view_item - Add to cart →
add_to_cart - Begin checkout →
begin_checkout - Complete purchase →
purchase - Verify all required parameters
- View product →
-
Check user properties
- Set user properties (if implemented)
- Verify in User Properties section
- Confirm persistence across events
-
Test on mobile device
- Repeat key tests on mobile
- Verify device_category: "mobile"
GTM + DebugView Combined Testing
Workflow:
-
Enable GTM Preview mode
-
Enable debug mode
-
Open both:
- GTM Tag Assistant (connected to site)
- GA4 DebugView (separate tab)
-
For each event:
- In GTM: Verify tag fires, variables populate
- In DebugView: Verify event appears with parameters
- Cross-check: Parameters match between GTM and GA4
-
Troubleshoot discrepancies:
- If tag fires in GTM but not in DebugView: Check Measurement ID
- If parameters missing: Check GTM variable mapping
- If wrong values: Check variable configuration
Best Practices
During Development:
- Test every new event immediately after implementation
- Use DebugView constantly while building
- Document expected vs actual behavior
- Take screenshots for team review
Before Launch:
- Complete full implementation test
- Test on multiple browsers (Chrome, Firefox, Safari)
- Test on mobile and desktop
- Test with ad blockers disabled and enabled
- Verify critical e-commerce events thoroughly
After Launch:
- Monitor DebugView for first 30-60 minutes
- Check for unexpected events or duplicates
- Verify event volumes roughly match expectations
- Confirm events appear in standard reports (wait 24-48 hours)
Regular Maintenance:
- Test after any website changes
- Verify after GTM container updates
- Check during CMS/platform upgrades
- Test new features before launch
Advanced Tips
Testing Consent Mode:
- Set consent to denied
- Verify events fire with consent status
- Check
ad_storageandanalytics_storageparameters - Update consent to granted
- Verify parameters update
Testing User ID:
- Implement User ID for logged-in users
- Verify
user_idappears in event details - Check persistence across sessions
- Test logout (user_id should clear)
Testing Server-Side Events:
- Send event via Measurement Protocol
- Check DebugView for event appearance
- Verify parameters match API payload
- Confirm
client_idconsistency