Skip to content

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.

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.

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”

In your Fusionaly dashboard, go to Administration → Agents and create an API key.

Add these to your shell profile (~/.zshrc or ~/.bashrc):

Terminal window
export FUSIONALY_HOST=https://your-fusionaly-instance.com
export FUSIONALY_API_KEY=your-api-key

Download the skill file and add it to your agent:

AgentLocation
Claude Code~/.claude/skills/fusionaly/SKILL.md
CursorProject rules or .cursor/rules/
WindsurfProject rules or .windsurf/rules/
Codex~/.codex/instructions/fusionaly/SKILL.md

Open your AI assistant and ask a question about your analytics. The agent will:

  1. Connect to your Fusionaly instance
  2. Generate appropriate SQL
  3. Execute the query
  4. Present results in a readable format

The Agent API exposes a SQL endpoint that accepts read-only queries. When you ask your AI assistant a question:

  1. You ask in English: “What’s my top traffic source?”
  2. AI generates SQL: SELECT referrer, COUNT(*) as visits FROM events WHERE ... GROUP BY referrer ORDER BY visits DESC LIMIT 10
  3. Fusionaly executes: Query runs against your local SQLite database
  4. Results return: JSON response with the data
  5. 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.

  • 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.

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
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.

Fusionaly Pro includes Ask AI — the same capability built directly into the dashboard. No setup required. Just type your question and get answers.

Compare Free vs Pro →