SlimStat Database Tables and Columns Reference
Applies to SlimStat 6.0.0 and SlimStat Pro 3.0.0 · checked
SlimStat 6 declares six core analytics tables plus three optional Ecommerce/heatmap tables. Core installs use the current base schema; upgraded sites can still need migrations, and optional tables are created by their feature setup. Inspect the actual schema before depending on a column, index or collation.
| Table suffix | Purpose |
|---|---|
slim_stats | Recorded pageviews and visit fields |
slim_stats_archive | Archived pageviews |
slim_events | Recorded interactions linked to pageviews |
slim_events_archive | Archived interactions |
slim_user_agents | Parsed browser dimension groundwork |
slim_meta | Analytics installation identity and maintenance leases |
slim_ecommerce | Optional order, product and coupon projections, created by Ecommerce setup |
slim_heatmap | Optional sampled click/scroll capture rows, created on first use |
slim_heatmap_elements | Element dictionary for heatmap capture |
Prefixes and database connection
Names use the configured table prefix. wp_slim_stats is only an example; a Multisite subsite can use another prefix. Core queries use the current WordPress $GLOBALS['wpdb']->prefix; Pro preserves that prefix when connecting to an external database. Use wp_slimstat::$wpdb, the configured analytics connection, for direct queries. $GLOBALS['wpdb'] may still point at WordPress’s main database.
Pro’s external-database option changes where analytics is stored. It does not turn analytics into a shared cloud service or combine independent WordPress installations into a network.
Pageview columns
The reviewed v6 schema, including acquisition reports, declares 43 columns in slim_stats, including:
| Group | Columns |
|---|---|
| Row and visit identity | id, visit_id, vid_hash |
| Visitor fields | ip, other_ip, username, email, fingerprint |
| Location | country, location, city |
| Source and page | referer, resource, searchterms, notes, outbound_resource |
| Timing | server_latency, page_performance, tz_offset, dt_out, dt |
| Browser and device | browser, browser_version, browser_type, platform, language, user_agent, resolution, screen_width, screen_height, ua_id |
| Acquisition | traffic_channel, traffic_source, utm_source, utm_medium, utm_campaign, utm_content, utm_term, utm_id |
| Content | content_type, category, author, content_id |
ua_id is a nullable BINARY(8) dimension key. vid_hash is a nullable BINARY(16) cookieless identity value. They may be absent while migrations are deferred; older rows need not have either value. Do not describe hashed identifiers as automatically anonymous.
The eight acquisition columns also require Enable UTM and channel reports on upgraded sites. traffic_channel is nullable VARCHAR(32); source and UTM fields are nullable VARBINARY(764) holding validated UTF-8 up to 191 characters. Exact comparisons preserve tag case. Historical rows remain unattributed. See campaign setup.
The browser dimension is groundwork, not a promise that every report now reads pre-aggregated data. Raw pageview fields remain relevant in v6.
Optional Ecommerce and heatmap storage
Ecommerce setup creates slim_ecommerce and an analytics visit index. WooCommerce remains authoritative; SlimStat stores a reporting projection and retained visit associations. The setup is separate from ordinary schema reconciliation.
Heatmap capture is off by default. Its dedicated tables are created on first use when capture is enabled and a compatible Pro viewer is present. Click/scroll rows follow retention and personal-data erasure; the element dictionary is bounded by site structure and is not purged on the same age schedule. Ordinary Events/Goals rows remain separate.
Events, indexes and character sets
slim_events contains event_id, type, event_description, notes, position, id and dt. Its id references a pageview; the declared foreign key cascades updates and deletions. The archive has no equivalent live-parent foreign key.
Fresh installs use InnoDB and utf8mb4, with collation resolved against WordPress user data when available. Upgraded tables can retain their older character set until the optional conversion runs. The schema includes date, visit, browser, country, goal and funnel indexes. Inspect your own tables rather than assuming an old optional-index list still describes v6:
SHOW CREATE TABLE wp_slim_stats;
SHOW INDEX FROM wp_slim_stats;
Replace wp_ with the actual analytics prefix. The source of truth is src/Schema/Schema.php in the Free plugin.
Read through the configured connection
Run custom reporting inside WordPress and restrict it to authorized users:
if ( current_user_can( 'manage_options' ) && class_exists( 'wp_slimstat' ) ) {
$db = wp_slimstat::$wpdb;
if ( $db instanceof wpdb ) {
$table = $GLOBALS['wpdb']->prefix . 'slim_stats';
$rows = $db->get_results( $db->prepare(
"SELECT resource, COUNT(*) AS hits FROM {$table}
WHERE dt > %d GROUP BY resource ORDER BY hits DESC LIMIT 10",
time() - 30 * DAY_IN_SECONDS
) );
foreach ( $rows as $row ) {
echo '<p>' . esc_html( $row->resource ) . ': ' . esc_html( (string) $row->hits ) . '</p>';
}
}
}
The connection is SlimStat’s configured analytics connection, and the table prefix comes from WordPress, not request input. For reports that should honor SlimStat’s active date filters, use the database API instead.
Retention and uninstall
Deleting Free preserves analytics unless Delete Data on Uninstall was enabled. Full deletion removes the declared analytics tables and plugin data, including on the configured external connection. The rebuildable browser-detection cache is removed even when analytics is retained. Back up before deleting or migrating.