Understanding Website Analytics
Alpha Insights includes a comprehensive built-in website analytics system that tracks visitor behavior and directly connects it to your profit data. Unlike Google Analytics, it shows which traffic sources actually generate profit, not just visits. This guide explains what’s tracked, how it works, and how to use it effectively.
New to Alpha Insights? Start with the How Alpha Insights Works guide to understand the complete system, then return here to enable website tracking.
Why Use Alpha Insights Analytics?
- Profit-focused: See which traffic sources generate profit, not just visits
- Deeply Integrated: Traffic data directly connected to order and profit data in your database
- Privacy-friendly: GDPR compliant, IP anonymization, no third-party tracking
- Simple: No complex setup or tracking codes to install – works automatically
- WooCommerce-focused: Built specifically for eCommerce, not general website analytics
- Lightweight: ~5KB JavaScript file vs 45KB+ for Google Analytics
What’s Different from Google Analytics?
| Feature | Alpha Insights | Google Analytics |
|---|---|---|
| Focus | Profit, ROAS, and costs | Traffic and behavior |
| Integration | Built into WooCommerce database | Separate third-party service |
| Setup | Automatic – one toggle | Requires tracking code and configuration |
| eCommerce Metrics | Profit, costs, ROAS by source | Revenue only |
| Privacy | Fully controlled by you | Data shared with Google |
| Order Attribution | Direct database connection | Requires complex configuration |
| Campaign Profit Tracking | Built-in with Facebook/Google Ads | Revenue only, no cost integration |
Recommendation: Use both systems together – Alpha Insights for profit insights and campaign ROI, Google Analytics for detailed user behavior analysis like scroll depth, video engagement, and detailed path analysis.
What Data Is Tracked?
Visitor Sessions
What is a session? A visitor’s continuous browsing activity on your site until they leave or are inactive for 10 minutes. Sessions are tracked using browser cookies.
Tracked session data:
- Session start time (date_created_gmt)
- Session end time (date_updated_gmt)
- Session duration (calculated from start and end)
- Pages viewed during session (count and list)
- Landing page (first page visited, with full URL and query parameters)
- Referral URL (where the visitor came from)
- Device type (mobile, desktop, tablet)
- Browser (Chrome, Safari, Firefox, Edge, etc.)
- Operating system (Windows, Mac, iOS, Android, Linux)
- IP address (stored, used for session identification)
- User ID (if logged in)
- Unique session ID (generated automatically)
Technical detail: Sessions are managed via three cookies:
wpd_ai_session_id– Unique session identifierwpd_ai_landing_page– First page URL visitedwpd_ai_referral_source– Where the visitor came from
All three cookies expire after 10 minutes of inactivity and are automatically renewed on each page view.
Traffic Sources
Alpha Insights automatically categorizes where visitors come from by analyzing the referral URL and query parameters. For detailed information on how each source is detected and optimized, see the Traffic Source Analysis guide.
- Organic Search: Google, Bing, Yahoo, DuckDuckGo, Brave, Ecosia, Qwant, Yandex, Baidu, etc. (unpaid search traffic)
- Google Ads: Detected via
gclidparameter or manual tagging - Social Media: Facebook, Instagram, Reddit, TikTok, Pinterest, Twitter, LinkedIn (organic social traffic)
- Email: Mailchimp, Klaviyo, Constant Contact, Campaign Monitor, ActiveCampaign, HubSpot, Brevo (Sendinblue), MailerLite, SendGrid, and more
- Direct: Typed URL, bookmarks, or unknown source (no referrer)
- Referral: Links from other websites
- AI Chat: Perplexity, ChatGPT, Claude, Gemini, Grok, DeepSeek (traffic from AI chat assistants)
- App: Mobile app or app-based traffic (
app://protocol) - Unknown: Could not be categorized
How detection works: The system checks in this order:
- Query parameters (
gclid,fbclid,utm_medium,mc_cid) – takes priority - Referral domain matching against known sources
- Referral analysis for search engines, social platforms, email providers
- Falls back to “Direct” if no referrer or “Referral” for unknown domains
Page Views
Each page a visitor views is tracked as an individual event:
- Page URL (full href including query parameters)
- Page title
- Object ID (WordPress post/page/product ID)
- Object type (page, post, product, category, etc.)
- Timestamp (GMT)
- Order in navigation (1st page, 2nd page, etc.)
Device Information
- Device category (Mobile, Desktop, Tablet) – detected from User Agent
- Operating system (Windows, Mac, iOS, Android, Linux, ChromeOS, etc.)
- Browser (Chrome, Safari, Firefox, Edge, Opera, Samsung Internet, etc.)
- Raw User Agent string (stored in additional_data field)
eCommerce Events
Alpha Insights tracks key eCommerce activities. For complete details on all event types, see the Event Types Reference.
- product_click: User clicks on a product in category/shop pages
- product_page_view: User views a product page (tracked as page_view with object_type=product)
- add_to_cart: User adds product to cart (tracked server-side)
- viewed_cart_page: User views the cart page
- init_checkout: User begins checkout process
- checkout_error: Checkout form errors (with error messages)
- transaction: Order successfully placed (tracked server-side)
- product_purchase: Individual product purchases within an order
Technical note: Some events are tracked via JavaScript (page views, clicks), others server-side (add to cart, transactions) for reliability.
Form Submissions
All form submissions are tracked (excluding password fields for security):
- Form ID/name/class
- Form action URL
- Form method (GET/POST)
- Timestamp
WooCommerce Events
Standard WooCommerce checkout events:
- updated_checkout
- payment_method_selected
- updated_shipping_method
- applied_coupon
- removed_coupon
- wc_cart_emptied
Conversion Data & Order Attribution
When a visitor places an order, Alpha Insights creates a powerful connection between the session and the order:
- Order amount and profit (from WooCommerce order calculations)
- Products purchased (with quantities and costs)
- Session data stored in order meta (
_wpd_ai_landing_page,_wpd_ai_referral_source) - Campaign IDs stored if present (
_wpd_ai_meta_campaign_id,_wpd_ai_google_campaign_id) - Full customer journey reconstructed from session events
- Traffic source attribution (Organic, Paid, Social, Email, etc.)
How it works: When an order is created, Alpha Insights automatically reads the visitor’s cookies and saves the landing page and referral data to the order meta. This creates a permanent link between the order and the marketing source.
What Is NOT Tracked
For privacy, performance, and legal compliance:
- Personally identifiable information (PII) outside of orders
- Full IP addresses (stored but can be anonymized based on settings)
- Form inputs or passwords (password fields explicitly filtered)
- Mouse movements, clicks, or heatmaps
- Scroll depth or scroll tracking
- Video plays or downloads
- File downloads
- Outbound link clicks (only internal site activity)
- Cross-domain tracking
- User identities (unless they log in or place an order)
How It Works Under The Hood
1. Frontend Tracking
Alpha Insights loads a lightweight JavaScript file (wpd-alpha-insights-event-tracking.js, ~5KB) that automatically tracks:
- Page views on every page load
- Product clicks on category pages
- Form submissions
- WooCommerce checkout events
Events are sent to a WordPress REST API endpoint (/wp-json/alpha-insights/v1/woocommerce-events) asynchronously, so they don’t block page rendering.
2. Session Management
On the first page load, Alpha Insights:
- Generates a unique session ID (MD5 hash of user agent + timestamp)
- Captures referral URL from HTTP headers
- Stores session data in cookies (10-minute expiry)
- Creates session record in database (
wpd_ai_session_datatable)
On subsequent page loads within 10 minutes:
- Reads existing session ID from cookie
- Updates session end time (
date_updated_gmt) - Refreshes cookie expiry (another 10 minutes)
- Adds new events to the session
3. Database Storage
Two custom database tables store the data:
- wpd_ai_session_data: Stores session metadata (session_id, landing_page, referral_url, device, browser, etc.)
- wpd_ai_events: Stores individual events (session_id, event_type, page_href, product_id, event_value, timestamp, etc.)
Sessions and events are linked via session_id, enabling full journey reconstruction.
4. Traffic Source Classification
The WPD_Traffic_Type class analyzes referral URLs and query parameters to categorize traffic sources. See the Traffic Source Analysis guide for detailed classification logic.
5. Order Attribution
When an order is created, the save_landing_page_to_order_meta() method:
- Reads cookies (
wpd_ai_landing_page,wpd_ai_referral_source) - Extracts campaign IDs from query parameters (
meta_cid,google_cid) - Saves all data to order meta fields
- Creates permanent link between order and traffic source
This enables profit tracking by traffic source and campaign in reports.
Bot Detection & Rate Limiting
Bot Detection
Alpha Insights automatically detects and excludes bots using the WPD_User_Agent class. Bot traffic is not tracked to ensure data accuracy. For more details, see the Privacy & Security guide.
Rate Limiting
To prevent abuse and spam, Alpha Insights enforces rate limiting. For complete security details, see the Privacy & Security guide.
- Maximum 60 requests per minute per IP address
- Exceeding this limit results in a 24-hour IP ban
- Protects database from spam and malicious traffic
Enabling Website Analytics
Activation
For complete settings documentation, see the General Settings guide.
- Go to Alpha Insights → Settings → General Settings
- Find Alpha Analytics & Event Tracking section
- Set Enable WooCommerce Event Tracking to True
- Optionally exclude specific user roles from tracking
- Click Save Changes
Tracking Options
Enable WooCommerce Event Tracking:
- True: Full analytics tracking enabled – tracks sessions, page views, and all eCommerce events
- False: Disable all tracking – only order-level profit calculations (no visitor data)
Note: Enabling this also enables product analytics including product clicks, add to carts, and purchase tracking.
Exclude These Roles From Tracking:
- Select user roles to exclude from tracking (e.g., administrators, shop managers)
- Highly recommended to exclude your own role to prevent skewing data with your own browsing
- Excluded users will not have their sessions or events tracked
- Orders from excluded users are still tracked for profit calculations
Viewing Analytics Data
Available Reports
Alpha Insights provides several pre-built reports for analyzing website traffic. To learn more about all pre-built reports, see Understanding Pre-Built Reports.
Analytics Overview Report
- Go to Alpha Insights → Website Traffic → Analytics Overview
- See high-level overview of website performance
Key metrics displayed:
- Total sessions
- Total page views
- Average pages per session
- Average session duration
- eCommerce transactions
- Total transaction value
- Conversion rate (transactions / sessions)
- Product performance metrics
- Top products by views and clicks
Traffic Channels Report
- Go to Alpha Insights → Website Traffic → Traffic Channels
- See detailed breakdown of where visitors come from
Data shown:
- Sessions by acquisition channel over time (line chart)
- Traffic data by acquisition source (data table)
- Traffic by referral domain/URL
- Traffic by UTM campaign
- Traffic by landing page
Table columns:
- Source name (Organic, Social, Email, etc.)
- Sessions (total visits from source)
- Users (unique visitors from source)
- Transactions (orders from source)
- Total value (revenue from source)
- Conversion rate (% of sessions that converted)
Example insights:
- “Organic search brings 40% of traffic but 60% of revenue”
- “Facebook organic brings many visitors but low conversion rate”
- “Email campaigns have highest conversion rate at 8.2%”
- “Direct traffic has highest average order value”
Website Sessions Report
- Go to Alpha Insights → Website Traffic → Website Sessions
- View detailed session-level data
Data shown:
- Individual session details in a paginated data table
- Session start and end times
- Session duration
- Landing page URL
- Referral source and categorization
- Device information (type, OS, browser)
- Events per session breakdown:
- Page views
- Product clicks
- Add to cart events
- Checkout initiation
- Transactions
- Transaction value per session (if order was placed)
- UTM campaign (if present)
Use this report to:
- Understand individual customer journeys
- Identify patterns in converting vs non-converting sessions
- Troubleshoot tracking issues
- Analyze specific campaigns or traffic sources
Realtime Dashboard
- Go to Alpha Insights → Website Traffic → Realtime Dashboard
- Monitor current website activity as it happens
Shows:
- Sessions by date (bar chart showing daily activity)
- Events over time (line chart showing event trends)
- Currently viewed pages (last 30 minutes)
- Acquisition sources (pie chart breakdown)
- Product activity in real-time
- UTM campaign performance
- Checkout errors (live feed)
- Recent transactions
Use during:
- Sales and promotions to monitor impact
- Campaign launches to verify tracking
- Website changes to identify issues
- Peak traffic periods
Key Analytics Metrics Explained
Sessions
What it is: Number of visits to your site
Important notes:
- One visitor can have multiple sessions
- Example: Someone visits Monday and again Wednesday = 2 sessions
- Sessions expire after 10 minutes of inactivity
- Counted from unique session IDs in database
Unique Visitors / Users
What it is: Number of individual people who visited
How it’s counted: Based on unique IP addresses within the date range (approximate, not 100% accurate due to IP changes, shared IPs, etc.)
Limitations:
- Same person on different networks = counted as different users
- Multiple people on same network = may be counted as one user
- VPNs and IP changes affect accuracy
Page Views
What it is: Total number of pages viewed across all sessions
Example: 1,000 sessions with average 3 pages each = 3,000 page views
Formula: Count of all events where event_type = 'page_view'
Pages Per Session
Formula: Total Page Views / Total Sessions
Benchmarks:
- Under 2 pages: Low engagement – users may not be finding what they want
- 2-4 pages: Average for eCommerce
- 4-6 pages: Good engagement
- Over 6 pages: High engagement – users exploring your store
Average Session Duration
What it is: Average time visitors spend on your site per session
Formula: (Sum of all session durations) / Total Sessions
How it’s calculated: date_updated_gmt - date_created_gmt for each session
Benchmarks:
- Under 1 minute: Very low engagement – possible bounce or quick abandonment
- 1-3 minutes: Typical for eCommerce with clear intent
- 3-5 minutes: Good engagement – users browsing and considering
- Over 5 minutes: High engagement – deep exploration or complex purchases
Conversion Rate
What it is: Percentage of sessions that result in an order
Formula: (Total Transactions / Total Sessions) × 100
eCommerce benchmarks:
- Under 1%: Low – needs significant optimization
- 1-2%: Average for most eCommerce stores
- 2-3%: Good – better than average
- 3-5%: Excellent – top performers
- Over 5%: Outstanding – best-in-class
Factors affecting conversion rate:
- Traffic source quality (email > organic > paid > social)
- Product-market fit
- Website UX and speed
- Pricing and shipping costs
- Trust signals (reviews, guarantees)
- Checkout friction
Revenue Per Session
Formula: Total Revenue / Total Sessions
Example: $50,000 revenue / 10,000 sessions = $5.00 per session
Use for:
- Understanding average visitor value
- Comparing traffic source quality
- Setting paid advertising budgets (max CPC should be lower than revenue per session × conversion rate)
- Calculating customer acquisition costs
Bounce Rate
Note: Alpha Insights does not currently track bounce rate explicitly. A session with only 1 page view and short duration could be considered a bounce.
Connecting Analytics to Profit & ROAS
Traffic Source Profit Analysis
Alpha Insights uniquely combines traffic data with profit calculations. To understand profit calculations, see How Alpha Insights Works. To add product costs for profit tracking, see Cost of Goods Manager.
Example Analysis:
Organic Search:
- Sessions: 5,000
- Orders: 225
- Revenue: $35,000
- Product Costs: $14,000
- Gross Profit: $21,000
- Conversion Rate: 4.5%
- Profit Per Session: $4.20
Facebook Organic:
- Sessions: 3,000
- Orders: 60
- Revenue: $9,000
- Product Costs: $3,600
- Gross Profit: $5,400
- Conversion Rate: 2.0%
- Profit Per Session: $1.80
Insight: Organic search generates 2.3x more profit per session and higher conversion rates. Consider investing more in SEO.
Campaign ROAS (Return on Ad Spend)
When Facebook Ads or Google Ads integrations are enabled:
- Ad spend automatically synced from ad platforms
- Orders attributed to campaigns via
meta_cidorgoogle_cidparameters - ROAS calculated: (Gross Profit / Ad Spend) or (Revenue / Ad Spend)
- Profit-based ROAS shows true profitability, not just revenue
Privacy Considerations
Privacy Features
- No third-party tracking: All data stored in your WordPress database on your server
- User role exclusion: Exclude administrators and other roles from tracking
- Session-based tracking: Without storing long-term personal identifiers
- IP addresses stored: Used for session identification and traffic source analysis
- No cross-site tracking: Only tracks activity on your own website
- No tracking pixels: Uses first-party cookies and REST API
- Bot filtering: Automatically excludes known bot traffic
- Rate limiting: Prevents spam and abuse
GDPR Compliance:
- Data stored on your server (you control data residency)
- No data shared with third parties
- IP addresses can be anonymized if needed
- Consider adding cookie consent notice for visitors
- Session data can be purged based on retention settings
Note: Session and event data is stored in your WordPress database and is not shared with any third parties. You have full control over the data collected and its retention period.
Performance Considerations
Impact on Site Speed
Alpha Insights analytics is designed to be lightweight and performant:
- ~5KB JavaScript file (compared to 45KB+ for Google Analytics)
- Asynchronous loading – doesn’t block page rendering
- REST API requests made after page load completes
- Server-side events (add to cart, transaction) have negligible impact
- No external DNS lookups or third-party requests
Expected performance impact: Less than 50ms added to page load time in most cases.
Database Size
Analytics data accumulates over time in two database tables:
Expected growth:
- Typical store (1,000 sessions/month, 10 events/session): ~2-3 MB/month (~20-30 MB/year)
- Medium store (5,000 sessions/month): ~10-15 MB/month (~120-180 MB/year)
- High traffic (10,000 sessions/month): ~20-30 MB/month (~240-360 MB/year)
- Very high traffic (50,000+ sessions/month): ~100+ MB/month (~1+ GB/year)
Database optimization:
- Tables are indexed for fast queries
- Old data can be archived or purged based on retention settings
- Data is compressed (JSON fields for additional data)
- Efficient queries use date ranges and filters
Recommendation: Configure data retention settings in General Settings to automatically purge old session data (e.g., keep 90 days or 365 days). Order data and attribution is always retained.
Server Load
Tracking load:
- Each page view = 1-2 database inserts
- REST API requests are lightweight (
- Bot traffic automatically filtered (no database writes)
- Rate limiting prevents spam
Reporting load:
- Reports use transient caching (5-15 minutes)
- Large datasets paginated and batched
- Date range filtering reduces query scope
- Indexes optimize query performance
Expected server impact: Minimal on most hosting environments. Shared hosting with 1,000+ sessions/day may experience slight load increases during report generation.
Best Practices
- Exclude admin roles: Always exclude administrator and shop manager roles to avoid skewing data with your own browsing
- Use UTM parameters: Tag all external marketing links with UTM parameters for accurate attribution (see UTM Tracking guide)
- Review Traffic Channels regularly: Check weekly to identify best-performing sources and optimize marketing budget
- Monitor Realtime Dashboard during campaigns: Verify tracking is working when launching new campaigns or making site changes
- Analyze individual sessions: Use Website Sessions report to understand customer journeys and identify conversion bottlenecks
- Focus on profit, not just traffic: Traffic sources with lower volume but higher conversion and AOV may be more valuable
- Set up data retention: Configure automatic data purging to manage database size (90-365 days recommended)
- Compare with Google Analytics: Use GA for detailed behavior analysis, Alpha Insights for profit and ROI
- Test tracking: After enabling, place a test order and verify it appears in reports with correct attribution
- Regular database maintenance: On high-traffic sites, optimize database tables monthly
Technical Reference
Database Tables:
wp_wpd_ai_session_data– Session metadatawp_wpd_ai_events– Individual events
Order Meta Keys:
_wpd_ai_landing_page– First page URL with query parameters_wpd_ai_referral_source– Referrer URL_wpd_ai_meta_campaign_id– Facebook campaign ID (if meta_cid present)_wpd_ai_google_campaign_id– Google campaign ID (if google_cid present)
Cookies:
wpd_ai_session_id– Session identifier (10-minute expiry)wpd_ai_landing_page– Landing page URL (10-minute expiry)wpd_ai_referral_source– Referrer URL (10-minute expiry)
REST API Endpoint:
POST /wp-json/alpha-insights/v1/woocommerce-events
PHP Classes:
WPD_Session_Tracking– Session managementWPD_WooCommerce_Events– Event trackingWPD_Traffic_Type– Traffic source classificationWPD_Data_Warehouse_React– Data aggregation and reportingWPD_User_Agent– Device and bot detection
JavaScript Object:
WpdAiEventTracking– Frontend event tracking class
Next Steps
- Read Traffic Source Analysis to optimize marketing budget
- Learn UTM Campaign Tracking for accurate attribution
- Review Technical Architecture for implementation details
- See Event Types Reference for all tracked events
- Check Troubleshooting Guide if you encounter issues
- Explore Creating Custom Reports to build traffic-based reports
- Set up Facebook Campaign Tracking for ad attribution
- Configure Google Ads Tracking for search campaign ROI