CLI Reference

The Gurulu CLI gives you full control over your analytics from the terminal. Manage sites, events, audiences, experiments, warehouses, and more without leaving your editor.

Installation

npm install -g @gurulu/cli

Requires Node.js 18 or later. You can also use npx @gurulu/cli without a global install.

Authentication

The CLI uses a device-link flow. Run the auth command and follow the browser prompt:

gurulu auth

This opens a browser window where you approve the device. The CLI stores your API key locally at ~/.gurulu/credentials.

For CI environments, set the GURULU_SECRET_KEY environment variable with a secret key from Settings > Developer > API Keys.

Commands

CommandDescription
gurulu authAuthenticate via device-link flow
gurulu initInstall tracker in current project
gurulu doctorValidate installation and connectivity
gurulu sites listList all sites in your workspace
gurulu sites createRegister a new site
gurulu sites getGet site details
gurulu events listList detected and custom events
gurulu events defineDefine a custom event
gurulu events verifyVerify an event definition fires
gurulu audiences listList audience segments
gurulu audiences createCreate an audience segment
gurulu insightsGet AI-generated insights
gurulu chatAsk analytics questions in natural language
gurulu experiments listList A/B experiments
gurulu experiments createCreate an experiment
gurulu alerts listList configured alerts
gurulu alerts createCreate a metric alert
gurulu destinations listList data destinations
gurulu destinations createAdd a data destination
gurulu warehouses listList connected warehouses
gurulu warehouses syncTrigger a warehouse sync
gurulu api-keys listList API keys
gurulu api-keys createCreate a new API key
gurulu auditView audit log
gurulu identityManage canonical identity resolution
gurulu playgroundOpen interactive query playground

Examples

Install tracker in a Next.js project

gurulu init --framework nextjs-app --site-id cmo09... --no-interactive

Define a signup event

gurulu events define \
  --site-id cmo09... \
  --name signup_click \
  --display-name "Signup Button Click" \
  --selector "button#signup" \
  --intent signup

Ask a question with AI chat

gurulu chat "What is my top converting traffic source this week?"

Export insights as JSON

gurulu insights --site-id cmo09... --format json