Database Schema

Get Started

WB Ad Manager Pro creates several custom database tables to store advertisers, campaigns, transactions, ad submissions, classifieds, analytics, A/B tests, rotation stats, and more. This reference documents every PRO table, its columns, indexes, and relationships.

Table Overview

Table Purpose
wbam_advertisers Advertiser accounts linked to WordPress users
wbam_campaigns Advertising campaigns with pricing models and budgets
wbam_packages Pre-defined ad packages for purchase
wbam_transactions Wallet credit/debit transaction log
wbam_ad_submissions Frontend ad submissions pending review
wbam_analytics Raw analytics events (impressions, clicks)
wbam_analytics_daily Daily aggregated analytics data
wbam_ab_tests A/B test configurations
wbam_ab_test_stats Daily stats per A/B test variant
wbam_audit_log Admin activity audit trail
wbam_classifieds Classified listing metadata
wbam_classified_meta Key-value meta storage for classifieds
wbam_classified_inquiries Buyer inquiries on classified listings
wbam_classified_reports User reports against classified listings
wbam_classified_upgrades Classified upgrade records (featured, bump, etc.)
wbam_rotation_stats Fair rotation tracking per placement
wbam_link_keywords Auto-linking keyword rules (Links Pro)
wbam_link_clicks_daily Daily aggregated link click stats (Links Pro)
wbam_link_clicks_detailed Detailed individual link clicks (Links Pro)
wbam_post_links Links discovered in post content (Links Pro)
wbam_link_health Link health check results (Links Pro)
wbam_link_groups Link/affiliate program groups (Links Pro)

wbam_advertisers

Stores advertiser account data. Each advertiser is linked to exactly one WordPress user via the user_id column.

CREATE TABLE {prefix}wbam_advertisers (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    user_id bigint(20) UNSIGNED NOT NULL,
    company_name varchar(200) DEFAULT NULL,
    status varchar(20) NOT NULL DEFAULT 'pending',
    balance decimal(10,2) NOT NULL DEFAULT 0.00,
    total_spent decimal(10,2) NOT NULL DEFAULT 0.00,
    website varchar(255) DEFAULT NULL,
    phone varchar(50) DEFAULT NULL,
    address text DEFAULT NULL,
    notification_settings text DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    UNIQUE KEY user_id (user_id),
    KEY status (status)
);

Status values: pending, active, suspended, banned

wbam_campaigns

Stores campaign configuration and spend tracking. Supports three pricing models: CPM (cost per mille), CPC (cost per click), and flat-rate.

CREATE TABLE {prefix}wbam_campaigns (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    advertiser_id bigint(20) UNSIGNED NOT NULL,
    ad_id bigint(20) UNSIGNED DEFAULT NULL,
    package_id bigint(20) UNSIGNED DEFAULT NULL,
    name varchar(200) NOT NULL,
    budget decimal(10,2) NOT NULL DEFAULT 0.00,
    spent decimal(19,6) NOT NULL DEFAULT 0.000000,
    billed_amount decimal(10,2) NOT NULL DEFAULT 0.00,
    last_billed_at datetime DEFAULT NULL,
    pricing_model varchar(20) NOT NULL DEFAULT 'flat',
    price_per_unit decimal(10,4) NOT NULL DEFAULT 0.0000,
    impressions_limit int(11) UNSIGNED DEFAULT NULL,
    clicks_limit int(11) UNSIGNED DEFAULT NULL,
    impressions int(11) UNSIGNED NOT NULL DEFAULT 0,
    clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    start_date datetime DEFAULT NULL,
    end_date datetime DEFAULT NULL,
    status varchar(20) NOT NULL DEFAULT 'draft',
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY advertiser_id (advertiser_id),
    KEY ad_id (ad_id),
    KEY package_id (package_id),
    KEY status (status),
    KEY start_date (start_date),
    KEY end_date (end_date)
);

Status values: draft, pending, active, paused, completed, expired, cancelled

Pricing models:
flat — Fixed price from package
cpm — Cost per 1,000 impressions (uses price_per_unit and impressions_limit)
cpc — Cost per click (uses price_per_unit and clicks_limit)

wbam_packages

Defines pre-configured advertising packages that advertisers can purchase. Packages determine ad placement, duration, pricing model, and limits.

CREATE TABLE {prefix}wbam_packages (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    name varchar(200) NOT NULL,
    description text DEFAULT NULL,
    placements text DEFAULT NULL,
    duration_days int(11) UNSIGNED NOT NULL DEFAULT 30,
    impressions_limit int(11) UNSIGNED DEFAULT NULL,
    clicks_limit int(11) UNSIGNED DEFAULT NULL,
    price decimal(10,2) NOT NULL DEFAULT 0.00,
    pricing_model varchar(20) NOT NULL DEFAULT 'flat',
    price_per_unit decimal(10,4) NOT NULL DEFAULT 0.0000,
    requires_approval tinyint(1) NOT NULL DEFAULT 1,
    max_ads int(11) UNSIGNED DEFAULT NULL,
    sort_order int(11) UNSIGNED NOT NULL DEFAULT 0,
    status varchar(20) NOT NULL DEFAULT 'active',
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY status (status),
    KEY sort_order (sort_order)
);

Notes: The placements column stores a serialized array. The price field is the flat-rate price; for CPM/CPC packages, price_per_unit holds the per-impression or per-click rate.

wbam_transactions

Records every wallet credit and debit as an immutable transaction log. Each row captures the balance before and after the transaction for audit purposes.

CREATE TABLE {prefix}wbam_transactions (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    advertiser_id bigint(20) UNSIGNED NOT NULL,
    campaign_id bigint(20) UNSIGNED DEFAULT NULL,
    package_id bigint(20) UNSIGNED DEFAULT NULL,
    order_id bigint(20) UNSIGNED DEFAULT NULL,
    amount decimal(10,2) NOT NULL DEFAULT 0.00,
    balance_before decimal(10,2) NOT NULL DEFAULT 0.00,
    balance_after decimal(10,2) NOT NULL DEFAULT 0.00,
    type varchar(20) NOT NULL DEFAULT 'credit',
    payment_method varchar(50) DEFAULT NULL,
    payment_id varchar(200) DEFAULT NULL,
    status varchar(20) NOT NULL DEFAULT 'pending',
    description varchar(500) DEFAULT NULL,
    notes text DEFAULT NULL,
    idempotency_key varchar(255) DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY advertiser_id (advertiser_id),
    KEY campaign_id (campaign_id),
    KEY order_id (order_id),
    KEY type (type),
    KEY status (status),
    KEY created_at (created_at),
    UNIQUE KEY idempotency_key (idempotency_key)
);

Transaction types (from Transaction::TYPES): payment, refund, campaign, package, adjustment, campaign_reserve, campaign_refund, campaign_adjust, classified

Status values: pending, completed, cancelled

The idempotency_key column has a UNIQUE constraint to prevent duplicate transactions from webhook retries or race conditions. Stripe uses stripe_payment_{pi_id}, WooCommerce uses wc_order_{id}_item_{item_id}.

wbam_ad_submissions

Tracks ad submissions from the frontend advertiser portal. Submissions go through a review workflow before becoming live ads.

CREATE TABLE {prefix}wbam_ad_submissions (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    advertiser_id bigint(20) UNSIGNED NOT NULL,
    ad_id bigint(20) UNSIGNED NOT NULL,
    package_id bigint(20) UNSIGNED DEFAULT NULL,
    campaign_id bigint(20) UNSIGNED DEFAULT NULL,
    status varchar(20) NOT NULL DEFAULT 'pending',
    admin_notes text DEFAULT NULL,
    submitted_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    reviewed_at datetime DEFAULT NULL,
    reviewed_by bigint(20) UNSIGNED DEFAULT NULL,
    PRIMARY KEY (id),
    KEY advertiser_id (advertiser_id),
    KEY ad_id (ad_id),
    KEY status (status),
    KEY submitted_at (submitted_at)
);

Status values: pending, approved, rejected, changes_requested

wbam_analytics

Stores raw analytics events (impressions and clicks) with full context including geographic and device data.

CREATE TABLE {prefix}wbam_analytics (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    ad_id bigint(20) UNSIGNED NOT NULL,
    campaign_id bigint(20) UNSIGNED DEFAULT NULL,
    event_type varchar(20) NOT NULL DEFAULT 'impression',
    user_id bigint(20) UNSIGNED DEFAULT NULL,
    ip_hash varchar(64) DEFAULT NULL,
    country varchar(2) DEFAULT NULL,
    region varchar(100) DEFAULT NULL,
    city varchar(100) DEFAULT NULL,
    device_type varchar(20) DEFAULT NULL,
    browser varchar(50) DEFAULT NULL,
    referrer varchar(500) DEFAULT NULL,
    placement varchar(50) DEFAULT NULL,
    page_url varchar(500) DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY ad_id (ad_id),
    KEY campaign_id (campaign_id),
    KEY event_type (event_type),
    KEY country (country),
    KEY created_at (created_at),
    KEY ad_event_date (ad_id, event_type, created_at)
);

Event types: impression, click

Raw events are aggregated into wbam_analytics_daily by the daily cron job, then older raw rows are pruned based on the aggregate_after_days setting (default: 7 days).

wbam_analytics_daily

Stores daily aggregated analytics data per ad. Created by the daily aggregation cron from wbam_analytics raw events.

CREATE TABLE {prefix}wbam_analytics_daily (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    ad_id bigint(20) UNSIGNED NOT NULL,
    campaign_id bigint(20) UNSIGNED DEFAULT NULL,
    date date NOT NULL,
    impressions int(11) UNSIGNED NOT NULL DEFAULT 0,
    clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    unique_impressions int(11) UNSIGNED NOT NULL DEFAULT 0,
    unique_clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    conversions int(11) UNSIGNED NOT NULL DEFAULT 0,
    revenue decimal(10,4) NOT NULL DEFAULT 0.0000,
    PRIMARY KEY (id),
    UNIQUE KEY ad_date (ad_id, date),
    KEY campaign_id (campaign_id),
    KEY date (date)
);

The UNIQUE KEY ad_date constraint ensures one row per ad per day, allowing upserts during aggregation.

wbam_ab_tests

Stores A/B test configurations including the original ad, variant ads, traffic split, and statistical parameters.

CREATE TABLE {prefix}wbam_ab_tests (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    name varchar(255) NOT NULL,
    status varchar(20) NOT NULL DEFAULT 'draft',
    original_ad_id bigint(20) UNSIGNED NOT NULL,
    variant_ad_ids text NOT NULL,
    traffic_split tinyint(3) UNSIGNED NOT NULL DEFAULT 50,
    goal varchar(20) NOT NULL DEFAULT 'ctr',
    min_sample_size int(10) UNSIGNED NOT NULL DEFAULT 100,
    confidence_level tinyint(3) UNSIGNED NOT NULL DEFAULT 95,
    winner_id bigint(20) UNSIGNED DEFAULT NULL,
    start_date datetime DEFAULT NULL,
    end_date datetime DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY status (status),
    KEY original_ad_id (original_ad_id)
);

Status values: draft, running, completed, cancelled

The variant_ad_ids column stores a serialized array of ad IDs. The traffic_split is the percentage of traffic sent to the original ad (remainder goes to variants). The goal determines which metric is used to pick the winner.

wbam_ab_test_stats

Stores daily performance stats for each variant in an A/B test.

CREATE TABLE {prefix}wbam_ab_test_stats (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    test_id bigint(20) UNSIGNED NOT NULL,
    ad_id bigint(20) UNSIGNED NOT NULL,
    date date NOT NULL,
    impressions int(10) UNSIGNED NOT NULL DEFAULT 0,
    clicks int(10) UNSIGNED NOT NULL DEFAULT 0,
    PRIMARY KEY (id),
    UNIQUE KEY test_ad_date (test_id, ad_id, date),
    KEY test_id (test_id)
);

The UNIQUE KEY test_ad_date constraint ensures one row per test variant per day.

wbam_audit_log

Records admin actions for security auditing. Tracks who did what, when, and the old/new values.

CREATE TABLE {prefix}wbam_audit_log (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    user_id bigint(20) UNSIGNED NOT NULL,
    action varchar(100) NOT NULL,
    object_type varchar(50) NOT NULL,
    object_id bigint(20) UNSIGNED DEFAULT NULL,
    old_value text DEFAULT NULL,
    new_value text DEFAULT NULL,
    ip_address varchar(45) DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY user_id (user_id),
    KEY action (action),
    KEY object_type (object_type),
    KEY created_at (created_at)
);

Old audit log entries are pruned by the daily cron job.

wbam_classifieds

Stores classified listing metadata. Each classified is backed by a WordPress post (post type wbam-classified) referenced via post_id.

CREATE TABLE {prefix}wbam_classifieds (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    post_id bigint(20) UNSIGNED NOT NULL,
    advertiser_id bigint(20) UNSIGNED NOT NULL,
    listing_type varchar(20) NOT NULL DEFAULT 'standard',
    price decimal(15,2) DEFAULT NULL,
    price_type varchar(20) NOT NULL DEFAULT 'fixed',
    currency varchar(3) NOT NULL DEFAULT 'USD',
    contact_email varchar(255) DEFAULT NULL,
    contact_phone varchar(50) DEFAULT NULL,
    contact_name varchar(200) DEFAULT NULL,
    contact_method varchar(20) NOT NULL DEFAULT 'form',
    contact_info text DEFAULT NULL,
    location_text varchar(255) DEFAULT NULL,
    item_condition varchar(20) DEFAULT NULL,
    expires_at datetime DEFAULT NULL,
    bumped_at datetime DEFAULT NULL,
    bump_count int(11) UNSIGNED NOT NULL DEFAULT 0,
    views_count int(11) UNSIGNED NOT NULL DEFAULT 0,
    inquiries_count int(11) UNSIGNED NOT NULL DEFAULT 0,
    status varchar(20) NOT NULL DEFAULT 'pending',
    moderation_notes text DEFAULT NULL,
    featured_fee decimal(10,2) NOT NULL DEFAULT 0.00,
    featured_fee_status varchar(20) NOT NULL DEFAULT 'unpaid',
    featured_expires_at datetime DEFAULT NULL,
    featured_duration int(11) NOT NULL DEFAULT 1,
    featured_billing_count int(11) NOT NULL DEFAULT 0,
    featured_max_billing int(11) NOT NULL DEFAULT 1,
    featured_next_billing datetime DEFAULT NULL,
    processing_lock datetime DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    UNIQUE KEY post_id (post_id),
    KEY advertiser_id (advertiser_id),
    KEY listing_type (listing_type),
    KEY status (status),
    KEY expires_at (expires_at),
    KEY bumped_at (bumped_at),
    KEY processing_lock (processing_lock)
);

Status values: pending, active, expired, sold, rejected, suspended

Featured billing columns: The featured_* columns manage recurring featured listing fees. The processing_lock prevents concurrent cron processing.

wbam_classified_meta

Key-value meta storage for classifieds, added in DB version 2.8.0. Mirrors the WordPress postmeta table structure.

CREATE TABLE {prefix}wbam_classified_meta (
    meta_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    classified_id bigint(20) UNSIGNED NOT NULL,
    meta_key varchar(255) NOT NULL,
    meta_value longtext DEFAULT NULL,
    PRIMARY KEY (meta_id),
    KEY classified_id (classified_id),
    KEY meta_key (meta_key(191))
);

wbam_classified_inquiries

Stores buyer inquiries submitted through classified listing contact forms.

CREATE TABLE {prefix}wbam_classified_inquiries (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    classified_id bigint(20) UNSIGNED NOT NULL,
    sender_user_id bigint(20) UNSIGNED DEFAULT NULL,
    sender_name varchar(200) NOT NULL,
    sender_email varchar(255) NOT NULL,
    sender_phone varchar(50) DEFAULT NULL,
    message text NOT NULL,
    status varchar(20) NOT NULL DEFAULT 'unread',
    read_at datetime DEFAULT NULL,
    replied_at datetime DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY classified_id (classified_id),
    KEY sender_user_id (sender_user_id),
    KEY status (status),
    KEY created_at (created_at)
);

Status values: unread, read, replied

wbam_classified_reports

Stores user reports filed against classified listings for moderation review.

CREATE TABLE {prefix}wbam_classified_reports (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    classified_id bigint(20) UNSIGNED NOT NULL,
    reporter_user_id bigint(20) UNSIGNED DEFAULT NULL,
    reporter_name varchar(200) NOT NULL,
    reporter_email varchar(255) NOT NULL,
    reason varchar(50) NOT NULL,
    details text DEFAULT NULL,
    status varchar(20) NOT NULL DEFAULT 'pending',
    admin_notes text DEFAULT NULL,
    reviewed_by bigint(20) UNSIGNED DEFAULT NULL,
    reviewed_at datetime DEFAULT NULL,
    resolved_at datetime DEFAULT NULL,
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY classified_id (classified_id),
    KEY reporter_user_id (reporter_user_id),
    KEY status (status),
    KEY reason (reason),
    KEY created_at (created_at)
);

Status values: pending, reviewed, resolved, dismissed

Reason values: Common reasons include spam, prohibited, misleading, duplicate, offensive, other.

wbam_rotation_stats

Tracks fair ad rotation statistics per placement per day. Used by the Rotation Engine to ensure equitable impression distribution.

CREATE TABLE {prefix}wbam_rotation_stats (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    placement varchar(100) NOT NULL,
    ad_id bigint(20) UNSIGNED NOT NULL,
    advertiser_id bigint(20) UNSIGNED NOT NULL DEFAULT 0,
    date date NOT NULL,
    impressions int(11) UNSIGNED NOT NULL DEFAULT 0,
    clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    share_percentage decimal(5,2) NOT NULL DEFAULT 0.00,
    PRIMARY KEY (id),
    UNIQUE KEY placement_ad_date (placement, ad_id, date),
    KEY advertiser_id (advertiser_id),
    KEY date (date)
);

The share_percentage column stores the actual percentage of impressions this ad received at the given placement for the day.

wbam_classified_upgrades

Tracks classified upgrade purchases (featured, highlighted, urgent, bump) with time-based expiration.

CREATE TABLE {prefix}wbam_classified_upgrades (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    classified_id bigint(20) UNSIGNED NOT NULL,
    package_id bigint(20) UNSIGNED DEFAULT NULL,
    transaction_id bigint(20) UNSIGNED DEFAULT NULL,
    upgrade_type varchar(50) NOT NULL,
    starts_at datetime NOT NULL,
    expires_at datetime NOT NULL,
    status varchar(20) NOT NULL DEFAULT 'active',
    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY classified_id (classified_id),
    KEY upgrade_type (upgrade_type),
    KEY expires_at (expires_at),
    KEY status (status)
);

Upgrade types: featured, highlighted, urgent, top, bump

Status values: active, expired, cancelled

Expired upgrades are processed by the daily cron job, which updates the status and triggers wbam_classified_downgraded / wbam_upgrades_expired actions.

The following tables are created by the Links Pro module for link management, auto-linking, click tracking, and health checking.

Stores auto-linking keyword rules that automatically convert keywords in post content to tracked links.

CREATE TABLE {prefix}wbam_link_keywords (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    link_id bigint(20) UNSIGNED NOT NULL,
    keyword varchar(200) NOT NULL,
    case_sensitive tinyint(1) DEFAULT 0,
    whole_word tinyint(1) DEFAULT 1,
    max_replacements int(11) DEFAULT 3,
    priority int(11) DEFAULT 0,
    post_types text DEFAULT NULL,
    exclude_posts text DEFAULT NULL,
    status varchar(20) DEFAULT 'active',
    created_at datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY link_id (link_id),
    KEY keyword (keyword),
    KEY status (status)
);

Daily aggregated click statistics for tracked links.

CREATE TABLE {prefix}wbam_link_clicks_daily (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    link_id bigint(20) UNSIGNED NOT NULL,
    date date NOT NULL,
    clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    unique_clicks int(11) UNSIGNED NOT NULL DEFAULT 0,
    conversions int(11) UNSIGNED NOT NULL DEFAULT 0,
    revenue decimal(10,4) DEFAULT 0.0000,
    PRIMARY KEY (id),
    UNIQUE KEY link_date (link_id, date),
    KEY date (date)
);

Detailed individual click records with full context including geographic data, device info, UTM parameters, and conversion tracking.

CREATE TABLE {prefix}wbam_link_clicks_detailed (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    link_id bigint(20) UNSIGNED NOT NULL,
    user_id bigint(20) UNSIGNED DEFAULT NULL,
    ip_hash varchar(64) DEFAULT NULL,
    country varchar(2) DEFAULT NULL,
    region varchar(100) DEFAULT NULL,
    city varchar(100) DEFAULT NULL,
    device_type varchar(20) DEFAULT NULL,
    browser varchar(50) DEFAULT NULL,
    os varchar(50) DEFAULT NULL,
    referrer varchar(500) DEFAULT NULL,
    source_url varchar(500) DEFAULT NULL,
    source_post_id bigint(20) UNSIGNED DEFAULT NULL,
    conversion_value decimal(10,4) DEFAULT NULL,
    utm_source varchar(100) DEFAULT NULL,
    utm_medium varchar(100) DEFAULT NULL,
    utm_campaign varchar(100) DEFAULT NULL,
    clicked_at datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY link_id (link_id),
    KEY user_id (user_id),
    KEY country (country),
    KEY clicked_at (clicked_at),
    KEY source_post_id (source_post_id)
);

wbam_post_links

Tracks all links discovered in post content by the link scanner. Identifies affiliate links, nofollow status, and link context.

CREATE TABLE {prefix}wbam_post_links (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    post_id bigint(20) UNSIGNED NOT NULL,
    link_id bigint(20) UNSIGNED DEFAULT NULL,
    url varchar(2000) NOT NULL,
    url_hash varchar(64) NOT NULL,
    anchor_text varchar(500) DEFAULT NULL,
    link_type varchar(20) DEFAULT 'external',
    is_affiliate tinyint(1) DEFAULT 0,
    is_nofollow tinyint(1) DEFAULT 0,
    is_sponsored tinyint(1) DEFAULT 0,
    target varchar(20) DEFAULT '_self',
    context varchar(50) DEFAULT 'content',
    position int(11) DEFAULT 0,
    first_detected datetime DEFAULT CURRENT_TIMESTAMP,
    last_checked datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    KEY post_id (post_id),
    KEY link_id (link_id),
    KEY url_hash (url_hash),
    KEY link_type (link_type),
    KEY is_affiliate (is_affiliate)
);

Link types: external, internal, affiliate, social

Stores the results of automated link health checks including HTTP status codes, response times, redirects, and broken link detection.

CREATE TABLE {prefix}wbam_link_health (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    link_id bigint(20) UNSIGNED DEFAULT NULL,
    post_link_id bigint(20) UNSIGNED DEFAULT NULL,
    url varchar(2000) NOT NULL,
    url_hash varchar(64) NOT NULL,
    status_code int(3) DEFAULT NULL,
    response_time int(11) DEFAULT NULL,
    redirect_url varchar(2000) DEFAULT NULL,
    redirect_count int(11) DEFAULT 0,
    is_broken tinyint(1) DEFAULT 0,
    is_redirect tinyint(1) DEFAULT 0,
    error_message varchar(500) DEFAULT NULL,
    last_checked datetime DEFAULT CURRENT_TIMESTAMP,
    check_count int(11) DEFAULT 1,
    PRIMARY KEY (id),
    KEY link_id (link_id),
    KEY post_link_id (post_link_id),
    KEY url_hash (url_hash),
    KEY is_broken (is_broken),
    KEY last_checked (last_checked)
);

Organizes links into groups (typically by affiliate program or network) with shared default settings.

CREATE TABLE {prefix}wbam_link_groups (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    name varchar(200) NOT NULL,
    slug varchar(100) NOT NULL,
    description text DEFAULT NULL,
    default_nofollow tinyint(1) DEFAULT 1,
    default_sponsored tinyint(1) DEFAULT 0,
    default_new_tab tinyint(1) DEFAULT 1,
    commission_rate decimal(5,2) DEFAULT NULL,
    network varchar(100) DEFAULT NULL,
    api_credentials text DEFAULT NULL,
    status varchar(20) DEFAULT 'active',
    created_at datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id),
    UNIQUE KEY slug (slug),
    KEY status (status)
);

The api_credentials column stores encrypted credentials for affiliate network API integrations.

Last updated: March 4, 2026