CLI
Command-line interface for Entrolytics
Entrolytics CLI
The @entrolytics/cli package provides a command-line interface for managing websites, viewing analytics, and generating tracking snippets.
Installation
# Global installation
pnpm add -g @entrolytics/cli
# Or use with npx
npx @entrolytics/cli --helpQuick Start
Initialize Project
The fastest way to get started is with the init command:
cd your-project
npx @entrolytics/cli initThis will:
- Authenticate you (if needed)
- Detect your framework (Next.js, React, Vue, etc.)
- Create or find your website
- Add credentials to
.env.local - Optionally install the appropriate package
Legacy Setup
If you prefer manual setup:
List Websites
entro-ng sites listView Stats
entro-ng stats <website-id> --period 7dCommands
Setup & Initialization
# Initialize Entrolytics in your project (recommended)
entro-ng init
# With options
entro-ng init --framework nextjs
entro-ng init --domain example.com
entro-ng init --website-id abc-123-def
entro-ng init --skip-install
# Verify tracking is working
entro-ng verify
entro-ng verify --website-id abc-123
# Update configuration
entro-ng update
entro-ng update --website-id new-id
entro-ng update --host https://custom.entrolytics.devAuthentication
# Login
entro-ng login
# Logout
entro-ng logout
# Show current user
entro-ng whoami
# Switch organization
entro-ng switch <org-id>Website Management
# List websites
entro-ng sites list
# Add website
entro-ng sites add example.com
# Remove website
entro-ng sites remove <website-id>
# Get website info
entro-ng sites info <website-id>
# Verify tracking script
entro-ng sites verify <website-id>Analytics
# Get website stats
entro-ng stats <website-id> --period 7d
# View realtime visitors
entro-ng realtime <website-id>
# Top pages
entro-ng top pages <website-id> --limit 10
# Top referrers
entro-ng top referrers <website-id>
# Top countries
entro-ng top countries <website-id>Link Management
# List links
entro-ng links list
# Create short link
entro-ng links create https://example.com/page --alias my-link
# Get link stats
entro-ng links stats <link-id>
# Delete link
entro-ng links delete <link-id>Snippets
# Generate tracking snippet
entro-ng snippet <website-id> --framework nextjs
entro-ng snippet <website-id> --framework react
entro-ng snippet <website-id> --framework htmlTesting
# Send test event
entro-ng test-event <website-id>Configuration
# Show config
entro-ng config
# Set API URL
entro-ng config set apiUrl https://your-domain.com
# Set default website
entro-ng config set defaultWebsite <website-id>Options
Global Options
--help, -h Show help
--version, -v Show version
--json Output as JSON
--no-color Disable colorsPeriod Options
--period, -p Time period
today Today only
yesterday Yesterday only
7d Last 7 days (default)
30d Last 30 days
90d Last 90 daysExamples
Quick Project Setup
# In your Next.js project
cd my-nextjs-app
entro-ng init
# Output:
# 🚀 Entrolytics Setup
#
# ✓ Detected NEXTJS project: my-nextjs-app
# ✓ Created website: my-nextjs-app
# ✓ Updated .env.local
# ✓ Installed @entrolytics/nextjs-sdk
#
# ✅ Entrolytics configured successfully!
#
# Next steps:
#
# 1. Add to app/layout.tsx:
# import { EntrolyticsProvider } from '@entrolytics/nextjs-sdk';
# // ... usage exampleVerify Tracking
entro-ng verify
# Output:
# 🔍 Verifying Entrolytics Setup
#
# ✓ Found website: my-nextjs-app
# ✓ Test event sent successfully
# ✓ Recent activity detected: 42 pageviews, 12 visitors
#
# ✅ Configuration:
# Website: my-nextjs-app
# Domain: example.com
# ID: abc-123-defUpdate Configuration
# Switch to a different website
entro-ng update --website-id new-website-id
# Change API host
entro-ng update --host https://analytics.mycompany.comView Weekly Stats
entro-ng stats abc-123-def --period 7dOutput:
📊 Website Stats (Last 7 Days)
Total Pageviews: 12,345 Unique Visitors: 3,456 Bounce Rate: 45% Avg. Session Duration: 2m 34s
Top Pages:
- / 4,567 views
- /about 1,234 views
- /pricing 987 views
Create and Track Link
# Create link
entro-ng links create https://example.com/landing --alias promo
# View stats
entro-ng links stats link-abc-123Generate Snippet
entro-ng snippet abc-123-def --framework nextjsOutput:
// Add to your app/layout.tsx
import { EntrolyticsProvider } from '@entrolytics/nextjs-sdk'
export default function RootLayout({ children }) {
return (
<html>
<body>
<EntrolyticsProvider
websiteId='abc-123-def'
host='https://entrolytics.dev'
>
{children}
</EntrolyticsProvider>
</body>
</html>
)
}Environment Variables
ENTROLYTICS_API_URL # API base URL
ENTROLYTICS_API_KEY # API key (alternative to OAuth)
ENTROLYTICS_DEFAULT_SITE # Default website IDConfiguration File
The CLI stores configuration in:
macOS: ~/Library/Application Support/entro-cli/
Linux: ~/.config/entro-cli/
Windows: %APPDATA%\entro-cli
CI/CD Usage
For automated workflows, use API key authentication:
export ENTROLYTICS_API_KEY=your-api-key
entro-ng stats abc-123-def --json | jq '.pageviews'Features
- ✅ One-command setup -
entro initconfigures everything - ✅ Auto framework detection - Detects Next.js, React, Vue, Svelte, Astro
- ✅ Safe environment management - Preserves existing .env variables
- ✅ Verification tools - Test tracking without leaving terminal
- ✅ Configuration updates - Easy credential refresh
- ✅ OAuth authentication with secure token storage
- ✅ Full website management
- ✅ Real-time analytics viewing
- ✅ Link shortener management
- ✅ Code snippet generation
- ✅ JSON output for scripting
- ✅ Colored, formatted output
- ✅ Cross-platform support
Workflows
New Project Setup
# Start a new Next.js project
npx create-next-app@latest my-app
cd my-app
# Set up Entrolytics (one command does it all!)
npx @entrolytics/cli init
# Start your dev server
npm run dev
# Verify tracking is working
npx @entrolytics/cli verifyExisting Project
# Navigate to your project
cd existing-project
# Initialize Entrolytics
entro-ng init
# If you already have a website ID
entro-ng init --website-id abc-123-def --skip-install
# Verify it's working
entro-ng verifyTeam Collaboration
# Team member clones repo
git clone https://github.com/company/project.git
cd project
# They just need to login (credentials already in .env.local)
entro-ng login
# Verify their setup works
entro-ng verify
# View shared analytics
entro-ng statsSwitching Websites
# Update to use a different website
entro-ng update --website-id production-site-id
# Verify the change
entro-ng verify
# View analytics for the new site
entro-ng statsSupport
- GitHub Issues
- Email: hey@entrolytics.dev