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?

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:

Technical detail: Sessions are managed via three cookies:

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.

How detection works: The system checks in this order:

  1. Query parameters (gclid, fbclid, utm_medium, mc_cid) - takes priority
  2. Referral domain matching against known sources
  3. Referral analysis for search engines, social platforms, email providers
  4. 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:

Device Information

eCommerce Events

Alpha Insights tracks key eCommerce activities. For complete details on all event types, see the Event Types Reference.

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):

WooCommerce Events

Standard WooCommerce checkout events:

Conversion Data & Order Attribution

When a visitor places an order, Alpha Insights creates a powerful connection between the session and the order:

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:

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:

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:

  1. Generates a unique session ID (MD5 hash of user agent + timestamp)
  2. Captures referral URL from HTTP headers
  3. Stores session data in cookies (10-minute expiry)
  4. Creates session record in database (wpd_ai_session_data table)

On subsequent page loads within 10 minutes:

  1. Reads existing session ID from cookie
  2. Updates session end time (date_updated_gmt)
  3. Refreshes cookie expiry (another 10 minutes)
  4. Adds new events to the session

3. Database Storage

Two custom database tables store the data:

Sessions and events are linked via session_id, enabling full journey reconstruction.

4. Traffic Source Classification

The WPDAI_Traffic_Type_Detection 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:

  1. Reads cookies (wpd_ai_landing_page, wpd_ai_referral_source)
  2. Extracts campaign IDs from query parameters (meta_cid, google_cid)
  3. Saves all data to order meta fields
  4. 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 WPDAI_User_Agent_Classification 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.

Enabling Website Analytics

Activation

For complete settings documentation, see the General Settings guide.

  1. Go to Alpha Insights → Settings → General Settings
  2. Find Alpha Analytics & Event Tracking section
  3. Set Enable WooCommerce Event Tracking to True
  4. Optionally exclude specific user roles from tracking
  5. Click Save Changes

Tracking Options

Enable WooCommerce Event Tracking:

Note: Enabling this also enables product analytics including product clicks, add to carts, and purchase tracking.

Exclude These Roles From Tracking:

Only Track & Report On Engaged Sessions:

Attribution Window Timeout (days):

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

  1. Go to Alpha Insights → Website Traffic → Analytics Overview
  2. See high-level overview of website performance

Key metrics displayed:

Traffic Channels Report

  1. Go to Alpha Insights → Website Traffic → Traffic Channels
  2. See detailed breakdown of where visitors come from

Data shown:

Table columns:

Example insights:

Website Sessions Report

  1. Go to Alpha Insights → Website Traffic → Website Sessions
  2. View detailed session-level data

Data shown:

Use this report to:

Realtime Dashboard

  1. Go to Alpha Insights → Website Traffic → Realtime Dashboard
  2. Monitor current website activity as it happens

Shows:

Use during:

Key Analytics Metrics Explained

Sessions

What it is: Number of visits to your site

Important notes:

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:

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:

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:

Conversion Rate

What it is: Percentage of sessions that result in an order

Formula: (Total Transactions / Total Sessions) × 100

eCommerce benchmarks:

Factors affecting conversion rate:

Revenue Per Session

Formula: Total Revenue / Total Sessions

Example: $50,000 revenue / 10,000 sessions = $5.00 per session

Use for:

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:

Privacy Considerations

Privacy Features

GDPR Compliance:

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:

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:

Database optimization:

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:

Reporting load:

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

Technical Reference

Database Tables:

Order Meta Keys:

Cookies:

REST API Endpoint:

PHP Classes:

JavaScript Object:

Next Steps