Plausible Analytics AI tool for the Laravel AI SDK — query stats, realtime visitors, manage sites and goals. Part of the OpenCompany AI tool ecosystem.
Give your AI agents access to privacy-friendly web analytics. Query traffic data, track realtime visitors, and manage sites and conversion goals — all through the Plausible Analytics API.
OpenCompany is an AI-powered workplace platform where teams deploy and coordinate multiple AI agents alongside human collaborators. It combines team messaging, document collaboration, task management, and intelligent automation in a single workspace — with built-in approval workflows and granular permission controls so organizations can adopt AI agents safely and transparently.
This Plausible tool lets AI agents query website analytics, monitor realtime traffic, and manage tracking configuration — giving agents data-driven awareness of web properties.
OpenCompany is built with Laravel, Vue 3, and Inertia.js. Learn more at github.com/OpenCompanyApp.
composer require opencompanyapp/ai-tool-plausibleLaravel auto-discovers the service provider. No manual registration needed.
This tool requires a Plausible Analytics API key.
In OpenCompany, credentials are managed through the Integrations UI.
For standalone usage, create config/ai-tools.php:
return [
'plausible' => [
'api_key' => env('PLAUSIBLE_API_KEY'),
'url' => env('PLAUSIBLE_URL', 'https://plausible.io'),
'sites' => ['example.com', 'blog.example.com'],
],
];| Tool | Type | Description |
|---|---|---|
plausible_query_stats |
read | Query website analytics — aggregate, timeseries, breakdowns by dimension |
plausible_realtime_visitors |
read | Current realtime visitor count (last 5 minutes) |
plausible_list_sites |
read | List all tracked websites |
plausible_create_site |
write | Register a new website for tracking |
plausible_delete_site |
write | Remove a website from tracking |
plausible_list_goals |
read | List conversion goals for a site |
plausible_create_goal |
write | Create a conversion goal (page visit or custom event) |
plausible_delete_goal |
write | Delete a conversion goal |
use Laravel\Ai\Facades\Ai;
use OpenCompany\AiToolPlausible\PlausibleService;
use OpenCompany\AiToolPlausible\Tools\PlausibleQueryStats;
use OpenCompany\AiToolPlausible\Tools\PlausibleRealtimeVisitors;
// Create tools
$service = app(PlausibleService::class);
$tools = [
new PlausibleQueryStats($service),
new PlausibleRealtimeVisitors($service),
];
// Use with an AI agent
$response = Ai::agent()
->tools($tools)
->prompt('How many visitors did example.com get this month?');If you have ai-tool-core installed, all 8 tools auto-register with the ToolProviderRegistry:
use OpenCompany\AiToolCore\Support\ToolProviderRegistry;
$registry = app(ToolProviderRegistry::class);
$provider = $registry->get('plausible');
// Create any tool via the provider
$tool = $provider->createTool(
\OpenCompany\AiToolPlausible\Tools\PlausibleQueryStats::class
);use OpenCompany\AiToolPlausible\PlausibleService;
$service = app(PlausibleService::class);
// Query stats
$stats = $service->query([
'site_id' => 'example.com',
'metrics' => ['visitors', 'pageviews'],
'date_range' => '30d',
]);
// Realtime visitors
$count = $service->realtimeVisitors('example.com');
// List sites
$sites = $service->listSites();
// Manage goals
$goals = $service->listGoals('example.com');
$service->createGoal('example.com', ['goal_type' => 'event', 'event_name' => 'Signup']);| Package | Purpose |
|---|---|
| opencompanyapp/ai-tool-core | ToolProvider contract and registry |
| laravel/ai | Laravel AI SDK Tool contract |
- PHP 8.2+
- Laravel 11 or 12
- Laravel AI SDK ^0.1
- A Plausible Analytics account with API access
MIT — see LICENSE