This comprehensive troubleshooting guide helps you diagnose and fix common issues with Alpha Insights website traffic tracking. Follow the diagnostic steps for your specific problem to quickly identify and resolve issues.
General troubleshooting: For general Alpha Insights troubleshooting, see Troubleshooting Performance. This guide focuses specifically on website traffic tracking issues.
Before diving into specific issues, run through this quick checklist:
Reports show zero sessions, zero page views, or "No data available"
Quick reference: For understanding how tracking works, see the Technical Architecture guide.
1. Analytics is disabled
Check:
Settings → General Settings → Alpha Analytics & Event Tracking
Verify "Enable Woocommerce Event Tracking" = True
Solution: Enable tracking and wait a few minutes for data to appear
2. You're excluded from tracking
Check:
Settings → General Settings → "Exclude These Roles From Tracking"
Verify your user role is NOT in the exclusion list
Solution:
3. Date range is incorrect
Check: Report date range in date picker
Solution:
4. No actual traffic yet
Check: Realtime Dashboard for live activity
Solution:
5. JavaScript not loading
Check: Browser developer tools (F12) → Network tab → look for wpd-alpha-insights-event-tracking.js
Solution:
wp-content/plugins/wp-davies-alpha-insights/assets/js/wpd-alpha-insights-event-tracking.js6. Database tables missing
Check: Via phpMyAdmin or WP-CLI
// Check if tables exist
SHOW TABLES LIKE 'wp_wpd_ai_%';
// Should show:
// wp_wpd_ai_session_data
// wp_wpd_ai_events
Solution:
Events might be tracked, but no sessions appear in reports
1. Check database directly
SELECT * FROM wp_wpd_ai_session_data
WHERE date_created_gmt > DATE_SUB(NOW(), INTERVAL 1 HOUR)
ORDER BY date_created_gmt DESC
LIMIT 10;
If no results: Sessions not being created at all
2. Check if cookies are set
wpd_ai_session_id, wpd_ai_landing_page, wpd_ai_referral_sourceIf cookies missing:
3. Check for bot detection false positive
// Test if you're being flagged as a bot
// Add this temporarily to your theme's functions.php
add_action('template_redirect', function() {
$user_agent = new WPDAI_User_Agent_Classification();
if ($user_agent->isBot()) {
error_log('Bot detected: ' . $_SERVER['HTTP_USER_AGENT']);
}
});
If you're flagged as bot:
4. Check PHP errors
// Enable WordPress debug logging
// In wp-config.php (temporarily):
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
// Then check: wp-content/debug.log for errors
Sessions exist but specific events (page views, add to cart, etc.) are missing
1. Check REST API endpoint
// Test API endpoint manually
// Open browser console and run:
fetch('/wp-json/alpha-insights/v1/woocommerce-events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Referer': window.location.href
},
body: JSON.stringify({
event_type: 'test_event',
page_href: window.location.href
})
})
.then(r => r.json())
.then(data => console.log('API Response:', data))
.catch(err => console.error('API Error:', err));
Expected response: {"message": "1 rows were inserted into the db."}
If error 403: Referer validation failing (check if domain matches)
If error 404: REST API not working (check permalink settings)
If error 429: Rate limit exceeded (wait 60 seconds)
2. Check JavaScript console for errors
WpdAiEventTracking or alpha-insightsCommon JavaScript errors:
WpdAiEventTracking is not defined → Script not loadedjQuery is not defined → jQuery not loaded (required)wpdAlphaInsightsEventTracking is not defined → Localized variables missing3. Check Network tab for API calls
/wp-json/alpha-insights/v1/woocommerce-eventsIf no API calls: JavaScript not firing events
If API calls failing: Check response status and error message
4. Check for rate limiting
// Check if your IP is rate limited
// Run in WordPress admin or via WP-CLI:
$ip = '192.168.1.100'; // Your IP
$transient_key = 'wpd_ai_rate_limit_' . md5($ip);
$count = get_transient($transient_key);
echo "Request count: " . $count . " / 60";
// Check if banned
$ban_key = 'wpd_ai_ip_banned_' . md5($ip);
$banned = get_transient($ban_key);
echo "Banned: " . ($banned ? 'Yes' : 'No');
If rate limited: Wait 60 seconds
If banned: Wait 24 hours or delete transient manually
Orders show in WooCommerce but landing page/referrer not saved to order meta
1. Check if landing page cookie exists at time of order
wpd_ai_landing_page cookie existsIf cookie missing or expires:
2. Check order meta after purchase
// Query order meta in database
SELECT meta_key, meta_value
FROM wp_postmeta
WHERE post_id = [ORDER_ID]
AND meta_key LIKE '_wpd_ai%';
// Should show:
// _wpd_ai_landing_page
// _wpd_ai_referral_source
// _wpd_ai_meta_campaign_id (if present)
// _wpd_ai_google_campaign_id (if present)
If meta fields missing:
save_landing_page_to_order_meta() not firing3. Check if hook is firing
// Add debugging temporarily
add_action('woocommerce_checkout_order_processed', function($order_id) {
error_log('Order processed: ' . $order_id);
error_log('Landing page cookie: ' . $_COOKIE['wpd_ai_landing_page'] ?? 'NOT SET');
}, 5); // Priority 5 (before Alpha Insights)
4. Test with fresh browser session
?utm_source=test&utm_campaign=debug)UTM-tagged URLs used, but campaigns don't appear in Traffic Channels report
Quick reference: For UTM best practices, see the UTM Campaign Tracking guide.
1. Verify UTM parameters in URL
?utm_source=...&utm_campaign=...If parameters missing:
2. Check landing page cookie value
wpd_ai_landing_page cookie valueIf UTMs not in cookie:
3. Check database for UTM data
// Check session landing pages
SELECT landing_page
FROM wp_wpd_ai_session_data
WHERE landing_page LIKE '%utm_campaign%'
ORDER BY date_created_gmt DESC
LIMIT 10;
If UTMs not in database:
4. Check report date range
5. Check for typos in UTM parameters
utm_source, utm_medium, utm_campaignutm-source, utmsource, UTM_SOURCETraffic categorized incorrectly (e.g., Facebook showing as "Unknown" instead of "Social")
Quick reference: For complete traffic source detection logic, see the Traffic Source Analysis guide.
1. Check referrer URL
// Query database to see actual referrer
SELECT referral_url, landing_page
FROM wp_wpd_ai_session_data
WHERE date_created_gmt > DATE_SUB(NOW(), INTERVAL 1 HOUR)
ORDER BY date_created_gmt DESC
LIMIT 20;
Common issues:
2. Social platforms strip referrers
Problem: Facebook, Instagram, TikTok often don't send referrer for privacy
Solution: Always use UTM parameters for social posts
// Instead of: https://yourstore.com/products
// Use: https://yourstore.com/products?utm_source=facebook&utm_medium=social
3. Check traffic source classification logic
// Test traffic source detection
$traffic_type = new WPDAI_Traffic_Type_Detection($referral_url, $query_params);
$source = $traffic_type->determine_traffic_source();
echo "Traffic source: " . $source;
4. Add custom source detection
// If platform not recognized, add via filter
add_filter('wpd_traffic_source', function($source, $referral_url, $query_params) {
if (strpos($referral_url, 'custom-platform.com') !== false) {
return 'Custom Platform';
}
return $source;
}, 10, 3);
Traffic happened hours ago but not yet in reports
Expected behavior:
1. Check Realtime Dashboard first
2. Clear transient cache
// Delete all report caches
DELETE FROM wp_options
WHERE option_name LIKE '_transient_wpd_%'
OR option_name LIKE '_transient_timeout_wpd_%';
3. Check if data actually exists
// Count today's sessions
SELECT COUNT(*) as sessions_today
FROM wp_wpd_ai_session_data
WHERE DATE(date_created_gmt) = CURDATE();
// Count today's events
SELECT COUNT(*) as events_today
FROM wp_wpd_ai_events
WHERE DATE(date_created_gmt) = CURDATE();
Sessions are created but page_view events missing or low count
1. Check if page view event is firing
/wp-json/alpha-insights/v1/woocommerce-events2. Check jQuery dependency
jQuery and press EnterIf jQuery missing:
3. Check if document.ready is firing
// Add to browser console
jQuery(document).ready(function() {
console.log('Document ready fired');
console.log('WpdAiEventTracking:', typeof WpdAiEventTracking);
console.log('Localized data:', wpdAlphaInsightsEventTracking);
});
4. Check for JavaScript conflicts
Products being added to cart but add_to_cart events not recorded
Add to cart is tracked server-side via woocommerce_add_to_cart hook for maximum reliability.
1. Verify add to cart actually works
2. Check if hook is firing
// Add debugging temporarily
add_action('woocommerce_add_to_cart', function($cart_item_key, $product_id, $quantity) {
error_log('Add to cart fired - Product: ' . $product_id . ', Qty: ' . $quantity);
}, 5, 3); // Priority 5 (before Alpha Insights at 10)
3. Check event in database
SELECT * FROM wp_wpd_ai_events
WHERE event_type = 'add_to_cart'
AND date_created_gmt > DATE_SUB(NOW(), INTERVAL 1 HOUR)
ORDER BY date_created_gmt DESC;
4. Check if session exists
Add to cart requires active session (with cookie)
wpd_ai_session_idMost traffic showing as "Direct" even though you know it comes from other sources
"Direct" traffic includes:
1. Use UTM parameters everywhere
utm_medium=emailutm_source=facebook etc.utm_medium=cpc2. Enable auto-tagging for ads
meta_cid={{campaign.id}} parameter3. Check for HTTPS issues
4. Accept some "Direct" is legitimate
// In wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
// Logs will be written to: wp-content/debug.log
// Via command line (curl)
curl -X POST https://yoursite.com/wp-json/alpha-insights/v1/woocommerce-events \
-H "Content-Type: application/json" \
-H "Referer: https://yoursite.com" \
-d '{
"event_type": "test_event",
"page_href": "https://yoursite.com/test",
"event_quantity": 1,
"event_value": 0
}'
// Recent sessions
SELECT * FROM wp_wpd_ai_session_data
ORDER BY date_created_gmt DESC LIMIT 10;
// Recent events
SELECT * FROM wp_wpd_ai_events
ORDER BY date_created_gmt DESC LIMIT 10;
// Event counts by type
SELECT event_type, COUNT(*) as count
FROM wp_wpd_ai_events
WHERE date_created_gmt > DATE_SUB(NOW(), INTERVAL 24 HOUR)
GROUP BY event_type;
Location varies by server:
public_html/error_logwp-content/debug.log (if debug enabled)/var/log/apache2/error.log or /var/log/php-fpm/error.logFor general performance optimization, see Optimizing Report Performance and Troubleshooting Performance.
Symptoms:
Diagnostic:
// Check database table sizes
SELECT
table_name,
ROUND((data_length + index_length) / 1024 / 1024, 2) as size_mb,
table_rows
FROM information_schema.tables
WHERE table_schema = DATABASE()
AND table_name LIKE 'wp_wpd_ai_%';
Solutions:
// Delete sessions older than 1 year
DELETE FROM wp_wpd_ai_session_data
WHERE date_created_gmt < DATE_SUB(NOW(), INTERVAL 365 DAY);
OPTIMIZE TABLE wp_wpd_ai_session_data;
OPTIMIZE TABLE wp_wpd_ai_events;
ALTER TABLE wp_wpd_ai_events ADD INDEX idx_event_type (event_type);
ALTER TABLE wp_wpd_ai_events ADD INDEX idx_session_id (session_id);
ALTER TABLE wp_wpd_ai_events ADD INDEX idx_date (date_created_gmt);
Before contacting support, gather:
Support checklist:
1. "Why doesn't my old data appear?"
2. "Why do I have multiple sessions for same visitor?"
3. "Why is my traffic not showing even though Google Analytics shows visitors?"
4. "Why does order show different source than I expected?"