Authentication
Statnive’s REST API uses standard WordPress REST authentication. You can authenticate with application passwords, cookie-based authentication (for logged-in users), or any authentication plugin that integrates with the WordPress REST API. Read endpoints require the manage_options capability; the public collection endpoints (/hit, /event, /engagement) are open to unauthenticated visitors so the tracker can post.
Base URL
All endpoints are registered under the statnive/v1 namespace:
https://yoursite.com/wp-json/statnive/v1/
Available Endpoints
Reporting (require manage_options)
GET /summary
Returns a summary of key metrics for a given date range.
Parameters:
from(string, required) — Start date inYYYY-MM-DDformat.to(string, required) — End date inYYYY-MM-DDformat.
GET /sources
Returns traffic source breakdown by channel.
GET /pages
Returns page-level analytics sorted by pageview count.
GET /pages/entry
Returns top entry (landing) pages for a date range.
GET /pages/exit
Returns top exit pages for a date range.
GET /realtime
Returns the current active visitor count and recent pageview feed.
GET /utm
Returns aggregated UTM parameter breakdowns for a date range.
GET /events
Returns aggregated custom event counts for a date range.
GET /events/{name}
Returns detail for a single named event.
GET /dimensions/{type}
Returns aggregated breakdowns for a single dimension ({type} is one of the supported dimension types, e.g. country, device, browser, language).
WooCommerce Revenue (v1.0.0+, require manage_options)
All revenue endpoints accept a from + to date-range (YYYY-MM-DD). Paginated endpoints additionally accept a limit (1–200, default 25; products defaults to 10, max 100).
GET /revenue/wc-status
Returns WooCommerce activation state, HPOS status, attribution status, and backfill progress.
POST /revenue/backfill
Triggers async historical order import via Action Scheduler (or WP-cron fallback).
GET /revenue/summary
Returns the 5 KPIs: orders, gross revenue, net revenue, average order value, refund total + rate, tax + shipping. Date bucketing uses COALESCE(date_paid_gmt, date_created_gmt) (v1.1.0+) so subscription renewals and delayed-payment orders land on the day payment cleared.
GET /revenue/timeseries
Returns daily revenue and order counts for the date range.
GET /revenue/by-channel
Returns orders, revenue, and AOV broken down by Statnive’s 8 traffic channels (Direct, AI Assistants, Organic Search, Social Media, Email, Referral, Paid Search, Paid Social).
GET /revenue/by-utm
Returns revenue broken down by utm_source, utm_medium, and utm_campaign (paginated).
GET /revenue/by-landing
Returns revenue broken down by entry landing page (paginated).
GET /revenue/products
Returns top products by units sold and revenue, refunds applied, variations grouped under parent (paginated; default limit=10).
GET /revenue/funnel
Returns the 4-stage Cart-to-Purchase Funnel (Viewed product → Added to cart → Started checkout → Completed purchase). v1.1.0+ shows per-step conversion %, with the Overall % computed against the widest-step denominator.
GET /revenue/refunds
Returns refund-rate trend and top refunded products.
GET /revenue/coupons
Returns coupon redemptions: code, count, discount amount, and net revenue after discount (paginated).
Ask me! Advisor (v1.1.0+, require manage_options)
GET /advisor/questions
Returns the full Ask me! question inventory (116 questions × 10 categories) with translated category labels, plan markers (free / paid), viz_hint, and a bilingual searchable[] array.
POST /advisor/answers
Resolves a batch of question IDs against the current site data. Body: { "ids": ["q2","q41",…], "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" }. Returns one answer envelope per ID (status ok with a viz payload, coming_soon, or error).
GET /advisor/preferences
Returns the current user’s pinned question IDs from wp_usermeta (default 5 pins if none set: q2, q41, q23, q72, q81).
PUT /advisor/preferences
Updates the current user’s pinned question IDs. Drops unknown IDs and enforces the MAX_PINS = 10 cap.
Configuration (require manage_options)
GET /settings
Returns the current plugin settings.
PUT /settings
Updates plugin settings. Accepts a JSON body of allowed keys (tracking_enabled, respect_dnt, respect_gpc, consent_mode, retention_days, retention_mode, excluded_ips, excluded_roles, geoip_enabled, maxmind_license_key).
GET /diagnostics
Returns a snapshot of plugin health (DB tables, GeoIP status, cron schedule, environment).
POST /self-test
Runs the in-process self-test suite.
POST /cron/run
Manually triggers Statnive’s scheduled cron jobs.
POST /diagnostics/enable-dbip-city
Enables the DB-IP City fallback for GeoIP lookups.
GET /privacy-audit
Returns a privacy audit summary.
Tracker collection (public)
These endpoints are written to by the bundled tracker and are intentionally open so unauthenticated visitors can post pageviews and events:
POST /hit
Records a pageview hit.
POST /event
Records a custom event.
POST /engagement
Records a session-engagement update (scroll depth, time on page).
Rate Limiting
Tracker collection endpoints (/hit, /event, /engagement) carry app-level throttling against abusive clients. Reporting endpoints rely on standard WordPress REST behaviour — wrap heavy automated polling in your own caching layer.