Add analytics to your frontend projects with one command
npm install -g @happenstance/cliyarn global add @happenstance/clipnpm add -g @happenstance/cliCheck that the CLI was installed correctly:
happenstance --versionGet started with Happenstance in 3 steps:
happenstance logincd your-projecthappenstance init This will auto-detect your framework and set up tracking.
Initialize Happenstance analytics in your project. Detects your framework, generates tracking events, and creates a pull request with the integration code.
--repo Specify GitHub repository (format: owner/repo)
Default: Auto-detected from git remote
--platform Deployment platform (netlify, vercel, railway, render, cloudflare)
Default: Auto-detected from config files
--no-webhook Skip GitHub webhook setup
--no-rebuild Skip triggering automatic rebuild
happenstance init --repo acme/my-app --platform vercelAuthenticate with Happenstance using OAuth. Opens a browser window to complete authentication.
happenstance loginCheck the setup status of Happenstance in the current project. Shows tracked events, API key status, and configuration.
happenstance status# Install CLI globally
npm install -g @happenstance/cli
# Authenticate
happenstance login
# Navigate to your project
cd my-react-app
# Initialize analytics
happenstance init The CLI will create a pull request with all tracking code integrated.
# GitHub Actions example
- name: Setup Happenstance
run: |
npm install -g @happenstance/cli
happenstance status
# Check if analytics are properly configured
- name: Verify Analytics
run: happenstance status --json | jq '.events_count'# Project A (React)
cd project-a
happenstance init --repo myorg/project-a
# Project B (Vue)
cd ../project-b
happenstance init --repo myorg/project-b
# Check status of all projects
for dir in project-*; do
cd $dir
echo "Status for $dir:"
happenstance status
cd ..
doneIf login fails or token expires:
# Remove stored credentials
rm -rf ~/.happenstance
# Re-authenticate
happenstance loginManually specify repository:
happenstance init --repo owner/repo-nameThe CLI auto-detects: React, Vue, Svelte, Angular, Next.js, SvelteKit
If detection fails, check:
View detailed help for any command:
happenstance --help
happenstance init --help Report issues: GitHub Issues