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, such as Claude Code, Cursor, or Codex, query your Fusionaly analytics with SQL. Your data never leaves your server. The AI generates SQL. Fusionaly runs it locally and returns the results.

Most analytics tools hide their queries from you. You click through dashboards someone else designed. When you need to answer a custom question, you export CSVs and process the data by hand.

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: The query runs locally, so your data stays private
  • Get direct answers: No dashboard hunting, no CSV exports

This works because Fusionaly uses SQLite. Your AI agent can query the single database file 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

Install the Fusionaly skill with the skills CLI:

Terminal window
npx skills add karloscodes/fusionaly-oss --skill fusionaly

This works with Claude Code, Cursor, Windsurf, Codex, and over 30 other AI agents.

Open your AI assistant and ask a question about your analytics. The agent does the following:

  1. Connects to your Fusionaly instance
  2. Generates the right SQL
  3. Runs the query
  4. Presents the 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: The query runs against your local SQLite database
  4. Results return: A JSON response with the data
  5. AI formats the answer: “Your top traffic source is Google, with 1,234 visits this month”

The AI never sees your raw data. It sees only the query results for your question.

  • Data stays local: Queries run on your server, not in the cloud
  • Read-only access: The API allows only SELECT queries
  • API key required: Every request must include your secret key
  • No data training: Fusionaly never uses your analytics data to train AI models

This is the advantage of combining self-hosted analytics with local AI tools: you control your data and your queries.

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 includes Ask AI. This is the same capability, built directly into the dashboard. Type your question and get an answer.

Ask AI is optional. It uses your own OpenRouter key. It never sends visitor data. Only your database schema and your questions go to OpenRouter.

See what’s included →