# GA4 FAQ Event Verification Guide

**Last Updated:** 2026-01-13

Step-by-step guide to verify FAQ tracking events are firing correctly in Google Analytics 4.

## Prerequisites

- Google Analytics 4 property configured
- GA4 tracking code installed on blog pages
- FAQ tracking script (`v2/js/faq-tracking.js`) integrated
- Access to GA4 DebugView or Real-time reports

## Verification Steps

### Step 1: Verify Script Integration

1. **Check Script File Exists:**

   ```bash
   ls -la v2/js/faq-tracking.js
   ```

   Should show the file exists.

2. **Check Integration in post.php:**

   ```bash
   grep -A 3 "faq-tracking.js" v2/pages/blog/post.php
   ```

   Should show script tag with version parameter.

3. **Verify Script Loads on Page:**
   - Open a blog post with FAQs (e.g., `/insights/lexikon/minijob/`)
   - Open browser DevTools (F12)
   - Go to Network tab
   - Filter by "faq-tracking"
   - Reload page
   - Should see `faq-tracking.js` loading with 200 status

### Step 2: Test FAQ Section Visibility Event

1. **Open Blog Post with FAQs:**

   - Navigate to any blog post with FAQs
   - Example: `/insights/lexikon/minijob/`

2. **Open GA4 DebugView:**

   - Go to Google Analytics 4
   - Navigate to Admin → DebugView
   - Enable debug mode (if not already enabled)

3. **Scroll to FAQ Section:**

   - Scroll down to the FAQ section
   - Wait 1-2 seconds

4. **Verify Event in DebugView:**
   - Look for event: `faq_section_viewed`
   - Check event parameters:
     - `page_title`: Should match blog post title
     - `page_path`: Should match URL path
     - `page_location`: Should match full URL

### Step 3: Test FAQ Question Click Event

1. **Click on FAQ Question:**

   - Click any FAQ question to expand/collapse it
   - The `<details>` element should toggle

2. **Verify Event in DebugView:**
   - Look for event: `faq_question_clicked`
   - Check event parameters:
     - `page_title`: Blog post title
     - `page_path`: URL path
     - `page_location`: Full URL
     - `faq_index`: Question number (1, 2, 3, etc.)
     - `faq_question`: Question text
     - `faq_id`: FAQ element ID

### Step 4: Test Scroll Depth Event

1. **Scroll to FAQ Section:**

   - Scroll down until FAQ section is visible
   - Continue scrolling past FAQ section

2. **Verify Event in DebugView:**
   - Look for event: `faq_scroll_depth`
   - Check event parameters:
     - `scroll_depth`: Percentage (0-100)
     - `page_title`: Blog post title
     - `page_path`: URL path

### Step 5: Verify Real-time Reports

1. **Open GA4 Real-time Report:**

   - Go to Reports → Real-time
   - Navigate to Events section

2. **Trigger Events:**

   - Open blog post in new tab
   - Scroll to FAQ section
   - Click FAQ questions
   - Scroll past FAQ section

3. **Verify Events Appear:**
   - Should see events:
     - `faq_section_viewed`
     - `faq_question_clicked`
     - `faq_scroll_depth`
   - Events should appear within 30 seconds

## Troubleshooting

### Events Not Appearing

**Issue:** No events showing in DebugView or Real-time

**Solutions:**

1. **Check Script Loading:**

   - Verify `faq-tracking.js` loads in Network tab
   - Check for JavaScript errors in Console

2. **Check GA4 Configuration:**

   - Verify `gtag` function is available: `typeof gtag !== 'undefined'`
   - Check GA4 tracking code is installed

3. **Check FAQ Structure:**

   - Verify FAQ section exists: `document.querySelector('.schema-faq')`
   - Check FAQ questions exist: `document.querySelectorAll('.schema-faq-question')`

4. **Enable Debug Mode:**
   - Add `?debug_mode=true` to URL
   - Or use GA4 DebugView

### Events Firing Multiple Times

**Issue:** Events firing multiple times for single action

**Solutions:**

1. **Check Script Loading:**

   - Ensure script only loads once
   - Check for duplicate script tags

2. **Check Event Listeners:**
   - Verify event listeners aren't duplicated
   - Check for multiple script executions

### Missing Event Parameters

**Issue:** Events firing but missing parameters

**Solutions:**

1. **Check JavaScript Console:**

   - Look for errors in browser console
   - Verify `gtag` function accepts parameters

2. **Verify Event Structure:**
   - Check event parameters match expected format
   - Verify all required parameters are included

## Manual Testing Checklist

- [ ] Script file exists (`v2/js/faq-tracking.js`)
- [ ] Script integrated in `post.php`
- [ ] Script loads on blog post pages
- [ ] No JavaScript errors in console
- [ ] FAQ section exists on test page
- [ ] `faq_section_viewed` event fires when FAQ section visible
- [ ] `faq_question_clicked` event fires when FAQ question clicked
- [ ] `faq_scroll_depth` event fires when scrolling to FAQ
- [ ] Events appear in GA4 DebugView
- [ ] Events appear in GA4 Real-time reports
- [ ] Event parameters are correct
- [ ] Events fire only once per action

## Automated Testing Script

Create a test script to verify FAQ tracking:

```javascript
// Test FAQ tracking events
(function () {
  console.log("Testing FAQ tracking...");

  // Check if gtag exists
  if (typeof gtag === "undefined") {
    console.error("❌ gtag not found");
    return;
  }
  console.log("✅ gtag found");

  // Check if FAQ section exists
  const faqSection = document.querySelector(".schema-faq");
  if (!faqSection) {
    console.error("❌ FAQ section not found");
    return;
  }
  console.log("✅ FAQ section found");

  // Check if FAQ questions exist
  const faqQuestions = document.querySelectorAll(".schema-faq-question");
  if (faqQuestions.length === 0) {
    console.error("❌ FAQ questions not found");
    return;
  }
  console.log(`✅ ${faqQuestions.length} FAQ questions found`);

  // Test event firing
  console.log("Testing events...");

  // Simulate FAQ section view
  const observer = new IntersectionObserver((entries) => {
    entries.forEach((entry) => {
      if (entry.isIntersecting) {
        console.log("✅ FAQ section visible - event should fire");
      }
    });
  });
  observer.observe(faqSection);

  console.log("✅ FAQ tracking test complete");
})();
```

## Next Steps

After verification:

1. Monitor events for 24-48 hours
2. Check event counts in GA4 reports
3. Verify event parameters are correct
4. Set up custom reports (see `FAQ_GA4_CUSTOM_REPORTS.md`)
5. Create alerts for unusual activity

## Related Documentation

- `FAQ_MONITORING_VERIFICATION.md` - Complete verification guide
- `FAQ_GA4_CUSTOM_REPORTS.md` - Custom reports setup
- `FAQ_MONITORING_QUICK_START.md` - Quick start guide
