WhoKnew Views™ | Testing Bot Filter Rules

Skip to main content
Table of Contents
Print

Verify your patterns are working with debug logs, activity monitoring, and simulation tools

You’ve added bot patterns—but how do you know they’re actually blocking traffic? WhoKnew Views™ provides multiple verification methods, from real-time debug logs to historical activity tracking. Here’s how to confirm your filters are working correctly.


🔬 Three Verification Methods

1

Debug Logging

Real-time detailed logs showing every User-Agent check, pattern testing, and match results. Best for immediate verification.

📍 wp-content/debug.log

2

System Info Activity Log

Persistent log of last 50 events including bot blocks. Best for ongoing monitoring and support tickets.

📍 WhoKnew Views → Admin → System Info

3

User-Agent Simulation

Pretend to be a bot using browser tools or online services. Best for testing before real traffic.

📍 Browser DevTools or online testers


📋 Method 1: WordPress Debug Logging

The most detailed verification method. WhoKnew Views™ logs every bot filter check when WordPress debug mode is enabled.

Step 1: Enable Debug Mode

📝 Edit wp-config.php
// Find this line (usually set to false):
define('WP_DEBUG', false);
// Replace with these three lines:
define('WP_DEBUG', true);         // Enable debugging
define('WP_DEBUG_LOG', true);     // Write to debug.log
define('WP_DEBUG_DISPLAY', false); // Hide errors from visitors

⚠️ Important: Never enable WP_DEBUG_DISPLAY on a live production site—it would show error messages to customers. Always set it to false.

Step 2: Trigger a Bot Check

Visit any product page on your site. Each page load triggers a bot filter check that gets logged.

Step 3: Check the Log File

📂 Log File Location

/wp-content/debug.log

Access via FTP, cPanel File Manager, or your hosting’s file browser. Look for entries starting with 🤖 WKV BOT FILTER CHECK.

Understanding the Log Output

🔍 EXAMPLE: Bot Detected (Blocked)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 WKV BOT FILTER CHECK
User-Agent: Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://semrush.com/bot.html)
Bot List Data Type: array
Bot List Empty: NO
Bot List is Array: YES
Bot List Count: 12
Checking bot pattern #0: Array ( [pattern] => GPTBot [added] => 1704499200 )
  Testing pattern: "GPTBot" against User-Agent
Checking bot pattern #1: Array ( [pattern] => Semrush [added] => 1704499200 )
  Testing pattern: "Semrush" against User-Agent
✅ BOT DETECTED - BLOCKING tracking
   Matched Pattern: "Semrush"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
👤 EXAMPLE: Real Visitor (Allowed)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🤖 WKV BOT FILTER CHECK
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...
Bot List Count: 12
Checking bot pattern #0: Testing pattern: "GPTBot" against User-Agent
Checking bot pattern #1: Testing pattern: "Semrush" against User-Agent
... (all 12 patterns tested)
❌ No bot patterns matched - ALLOWING tracking
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

💡 Pro Tip: Use tail -f /path/to/wp-content/debug.log in terminal to watch logs in real-time as you test. On Windows, use PowerShell’s Get-Content debug.log -Wait.


📊 Method 2: System Info Activity Log

WhoKnew Views™ Pro maintains a persistent activity log showing the last 50 events—including bot blocks. This is ideal for ongoing verification without keeping debug mode enabled.

📍 How to Access

  1. Navigate to WhoKnew Views → Admin
  2. Scroll down to System Info section
  3. Click 📋 Copy to Clipboard or scroll through the text area
  4. Look for bot_blocked entries in the activity log

What Gets Logged

Event TypeLogged WhenExample Entry
bot_blockedA bot pattern matches the visitor’s User-AgentBot detected: pattern ‘Semrush’ matched – view blocked
ip_blockedAn IP address matches the whitelistWhitelisted IP 192.168.1.* matched – view blocked
view_addedA real view is successfully countedView added for product #1234
📝 Example Activity Log Section
## RECENT ACTIVITY LOG (Last 50 Events) ##
[2025-01-06 14:23:15] bot_blocked - Bot detected: pattern 'GPTBot' matched - view blocked
[2025-01-06 14:22:58] view_added - Product #4521 - New real view counted
[2025-01-06 14:22:41] bot_blocked - Bot detected: pattern 'Semrush' matched - view blocked
[2025-01-06 14:21:33] view_added - Product #3892 - New real view counted
[2025-01-06 14:20:15] bot_blocked - Bot detected: pattern 'AhrefsBot' matched - view blocked
[2025-01-06 14:19:47] ip_blocked - Whitelisted IP 10.0.0.5 matched - view blocked
...

ℹ️ Log Limits: The activity log keeps only the last 50 entries to keep the database lightweight. For extended monitoring, periodically copy the System Info output to a text file.


🎭 Method 3: User-Agent Simulation

Want to test a pattern before real bots arrive? Simulate bot traffic by changing your browser’s User-Agent string.

Option A: Browser Developer Tools

🌐

Chrome / Edge
  1. Press F12 to open DevTools
  2. Click ⋮ menu → More tools
  3. Select Network conditions
  4. Uncheck “Use browser default”
  5. Enter a bot User-Agent string
  6. Refresh the product page

🦊

Firefox
  1. Type about:config in address bar
  2. Search for useragent.override
  3. Create new string preference
  4. Set value to a bot User-Agent
  5. Refresh the product page
  6. Delete the preference when done!
📋 Test User-Agent Strings to Copy

🤖 GPTBot (OpenAI)

Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot)

📊 SemrushBot

Mozilla/5.0 (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html)

🔍 Googlebot

Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)

Option B: Browser Extensions

These extensions make User-Agent switching easy:

User-Agent Switcher

Chrome / Firefox

Modheader

Chrome / Edge

User-Agent Switcher & Manager

Firefox

Option C: Command Line (Advanced)

🖥️ Using cURL to Test
# Request as GPTBot
curl -A "Mozilla/5.0 (compatible; GPTBot/1.2)" https://yourstore.com/product/widget/
# Request as Googlebot
curl -A "Googlebot/2.1 (+http://www.google.com/bot.html)" https://yourstore.com/product/widget/
# Request as normal Chrome user
curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0" https://yourstore.com/product/widget/

After each request, check your debug.log to see if the pattern matched.


🔍 Verification Checklist

✅ Confirm Your Pattern Is Working

1️⃣

Pattern appears in Active Filters list

Check the 🚫 Active Bot Filters section shows your pattern with a count badge.

2️⃣

Debug log shows pattern being tested

Look for: Testing pattern: "YourPattern" against User-Agent

3️⃣

Debug log shows match result

For bots: ✅ BOT DETECTED • For humans: ❌ No patterns matched

4️⃣

System Info shows bot_blocked events

Activity log entries like: Bot detected: pattern 'X' matched

5️⃣

View count doesn’t increment for bots

Simulate bot traffic, check the product’s view count—it should NOT increase.


🛠️ Troubleshooting Common Issues

❌ Pattern Not Matching Expected Bot

Cause:

The pattern doesn’t appear in the bot’s actual User-Agent string

Fix:

Check the exact User-Agent in debug.log and adjust your pattern. Remember: it’s substring matching, not exact match.

❌ Debug Log Shows Nothing

Cause:

WP_DEBUG or WP_DEBUG_LOG not enabled

Fix:

Double-check wp-config.php has BOTH constants set to true. Clear any caching plugins.

❌ Pattern Blocking Real Customers

Cause:

Pattern is too generic (e.g., “Chrome”, “Mozilla”, “Safari”)

Fix:

Remove the generic pattern immediately. Use bot-specific identifiers only.

❌ “Bot List Empty” in Debug Log

Cause:

No patterns have been added to the filter list yet

Fix:

Go to Admin → Bot Traffic Filter and add patterns from the catalog or create custom ones.


⚡ Quick Test Workflow

🚀 5-Minute Verification Process

1

Enable WP_DEBUG and WP_DEBUG_LOG in wp-config.php

2

Add a test pattern (e.g., TestBot123) to your filter

3

Use browser DevTools to set User-Agent to TestBot123/1.0

4

Visit any product page on your store

✓

Check debug.log for:✅ BOT DETECTED - BLOCKING tracking

💡 Remember: After testing, disable WP_DEBUG on production sites to avoid performance impact and prevent debug info from being written to logs. Remove your test pattern too!

Share