Agent API — AI-Powered Analytics Queries
Query your web analytics data using AI agents like Claude Code, Cursor, or Codex. Ask questions in plain English, get SQL that runs locally on your data.
Query your analytics with AI. Ask questions in plain English. Get answers from your own data.
The Agent API lets AI coding assistants (Claude Code, Cursor, Codex) query your Fusionaly analytics via SQL. Your data never leaves your server — the AI generates SQL, Fusionaly executes it locally, and returns the results.
Why AI + Self-Hosted Analytics
Section titled “Why AI + Self-Hosted Analytics”Most analytics tools are black boxes. You click through dashboards someone else designed. When you need a custom question answered, you export CSVs and wrangle data manually.
With Fusionaly’s Agent API:
- Ask in English: “What pages had the highest bounce rate last month?”
- AI writes the SQL: The agent generates a query against your schema
- Runs on your server: Query executes locally, data stays private
- Get direct answers: No dashboard hunting, no CSV exports
This works because Fusionaly uses SQLite — a single database file your AI agent can query directly.
What You Can Ask
Section titled “What You Can Ask”Once configured, ask your AI assistant questions like:
Traffic questions:
- “What were my top 10 pages last week?”
- “How many unique visitors came from Google this month?”
- “Show me traffic by country for the past 30 days”
Conversion questions:
- “Which referrers drove the most signups?”
- “What’s my conversion rate from the pricing page?”
- “Compare this week’s goal completions to last week”
Trend questions:
- “Is my traffic growing or shrinking?”
- “What day of the week gets the most visits?”
- “Show me a month-over-month comparison”
Custom analysis:
- “Which blog posts have the best engagement (scroll depth > 75%)?”
- “What’s the average session duration by traffic source?”
- “Find pages where visitors leave without clicking anything”
1. Get Your API Key
Section titled “1. Get Your API Key”In your Fusionaly dashboard, go to Administration → Agents and create an API key.
2. Set Environment Variables
Section titled “2. Set Environment Variables”Add these to your shell profile (~/.zshrc or ~/.bashrc):
export FUSIONALY_HOST=https://your-fusionaly-instance.comexport FUSIONALY_API_KEY=your-api-key3. Install the Skill
Section titled “3. Install the Skill”Download the skill file and add it to your agent:
| Agent | Location |
|---|---|
| Claude Code | ~/.claude/skills/fusionaly/SKILL.md |
| Cursor | Project rules or .cursor/rules/ |
| Windsurf | Project rules or .windsurf/rules/ |
| Codex | ~/.codex/instructions/fusionaly/SKILL.md |
4. Start Asking
Section titled “4. Start Asking”Open your AI assistant and ask a question about your analytics. The agent will:
- Connect to your Fusionaly instance
- Generate appropriate SQL
- Execute the query
- Present results in a readable format
How It Works
Section titled “How It Works”The Agent API exposes a SQL endpoint that accepts read-only queries. When you ask your AI assistant a question:
- You ask in English: “What’s my top traffic source?”
- AI generates SQL:
SELECT referrer, COUNT(*) as visits FROM events WHERE ... GROUP BY referrer ORDER BY visits DESC LIMIT 10 - Fusionaly executes: Query runs against your local SQLite database
- Results return: JSON response with the data
- AI formats answer: “Your top traffic source is Google with 1,234 visits this month”
The AI never sees your raw data — it only sees the query results you asked for.
Privacy & Security
Section titled “Privacy & Security”- Data stays local: Queries execute on your server, not in the cloud
- Read-only access: The API only allows SELECT queries
- API key required: All requests must include your secret key
- No data training: Your analytics data is never used to train AI models
This is the advantage of self-hosted analytics + local AI tooling. Your data, your queries, your control.
Supported AI Tools
Section titled “Supported AI Tools”Any AI coding assistant that can make HTTP requests works with the Agent API:
- Claude Code (Anthropic’s CLI)
- Cursor (AI code editor)
- Codex (OpenAI’s CLI)
- Windsurf (Codeium’s editor)
- Continue (open source)
- Aider (terminal-based)
- Custom agents via the REST API
Example Session
Section titled “Example Session”You: What were my top 5 pages yesterday?
Claude: I'll query your Fusionaly analytics.
Based on yesterday's data, your top 5 pages were:
| Page | Visitors | Avg Time ||-----------------------|----------|----------|| / | 342 | 45s || /docs/installation | 128 | 3m 12s || /pricing | 89 | 1m 45s || /why-fusionaly | 67 | 2m 30s || /docs/getting-started | 54 | 4m 15s |
The installation docs have high engagement (3+ minutes),suggesting visitors are actively setting up Fusionaly.Pro Feature: Ask AI
Section titled “Pro Feature: Ask AI”Fusionaly Pro includes Ask AI — the same capability built directly into the dashboard. No setup required. Just type your question and get answers.