-
Notifications
You must be signed in to change notification settings - Fork 0
AI Analytics Assistant
First release note: This is the initial implementation. The architecture is designed to avoid lock-in to any specific LLM provider and to keep the plugin free of AI API complexity.
The AI feature is split across two layers — the plugin provides structured data, the app provides the conversational AI.
The plugin exposes a single REST endpoint at /wp-json/rsa/v1/ai/tool. It accepts a tool name and returns structured JSON — no LLM call happens server-side.
Request:
{
"tool": "overview",
"params": { "period": "30d", "limit": 10 }
}Response:
{
"ok": true,
"data": {
"tool": "overview",
"period": "30d",
"data": { "pageviews": 1234, "sessions": 567, ... },
"premium": false
}
}Free tools (available to all authenticated users):
| Tool | Returns |
|---|---|
overview |
KPI summary (pageviews, sessions, avg time, bounce rate, daily sparkline) |
pages |
Top pages ranked by views |
audience |
OS, browser, viewport, language, timezone breakdowns |
referrers |
Top referring domains |
behavior |
Time-on-page histogram, session depth, entry pages |
Premium tools (require active Freemius licence):
| Tool | Returns |
|---|---|
campaigns |
UTM source/medium/campaign breakdown |
user-flow |
Miller-column path explorer data |
clicks |
Click element totals |
heatmap |
Viewport-relative click coordinates |
woocommerce |
Conversion funnel, top products, revenue |
All returned data is privacy-safe — IP addresses, email addresses, and session IDs are stripped before returning.
The PWA web app and desktop app provide the conversational interface. The user configures their own AI provider (OpenAI or any OpenAI-compatible endpoint) in the app's Install → AI Assistant Provider settings.
When the user asks a question:
- The app calls
POST /ai/toolon each connected site to fetch relevant analytics data - The app packages the structured data into a system prompt
- The app sends the prompt + question to the user's configured LLM
- The LLM response is displayed in the chat UI
No API key is stored on the server. The AI provider key lives only in the app's localStorage, never sent to the WordPress site.
The Overview dashboard page includes a free Insights section (no LLM required). Insight cards are computed server-side from your analytics data — top page, bounce rate assessment, engagement ratio, top referrer, and top campaign.
- Consistent AI voice across multiple sites — the app uses a single LLM regardless of what each site's plugin version is
- Multi-site queries — the app can combine data from all connected sites and ask the LLM to compare them
- No server-side AI cost — the plugin never makes an API call, has no API key to manage, and no LLM failures to handle
-
Privacy — the structured data returned by
/ai/toolcontains no PII; the user's API key stays on their device - Offline-capable — the desktop app can bundle a local LLM in future without any plugin changes
- Future-proof — adding new tools doesn't require LLM prompt engineering; the app decides what data to fetch and how to present it
Plugin side: No configuration needed. The /ai/tool endpoint is available automatically to authenticated users.
App side: In the PWA or desktop app, navigate to Install → AI Assistant Provider and enter:
-
API Endpoint — OpenAI-compatible chat completions URL (default:
https://api.openai.com/v1/chat/completions) - API Key — your API key (not required for local LLMs like Ollama)
-
Model — the model name to use (default:
gpt-4o-mini)
# Fetch overview data (free)
curl -X POST https://yoursite.com/wp-json/rsa/v1/ai/tool \
-H "Authorization: Basic $(echo -n 'user:app_pass' | base64)" \
-d '{"tool":"overview","params":{"period":"7d"}}'
# Fetch campaigns data (premium)
curl -X POST https://yoursite.com/wp-json/rsa/v1/ai/tool \
-H "Authorization: Basic $(echo -n 'user:app_pass' | base64)" \
-d '{"tool":"campaigns","params":{"period":"30d","limit":5}}'- The
/ai/toolendpoint is protected by the same authentication as all other REST API endpoints (WordPress Application Passwords) - Free tools are available to any authenticated user; premium tools require an active Freemius licence
- No data from the tool endpoint is cached on external servers — it's delivered directly to the requesting app
- The app's AI provider key is stored in
localStorageon the user's device, never transmitted to the WordPress site
- Home
- Release Tracks — Branch structure, promotion flows
- CI/CD Reference — Workflows, Freemius, deployment
- App Server Setup — Server infrastructure
- Code Map — Project structure