Terminal-based analytics setup for builders
How to Set Up Amplitude Analytics from Your Terminal
Set up product analytics without leaving your terminal. Have a coding agent instrument your app, install an SDK with one command, or script your projects with the Amplitude CLI.
You can set up Amplitude Analytics from the same terminal you ship code from. A coding agent can install the SDK and instrument your first event, a package manager installs the SDK in one command, and the Amplitude CLI manages projects, taxonomy, and feature flags from a shell or a script.
Three ways to set up Amplitude from the terminal
Terminal setup with Amplitude comes in three forms, and most teams end up using more than one.
- Coding agent setup. You paste a setup prompt into a coding agent such as Claude Code, Cursor, or Codex. The agent reads your codebase, installs the right SDK, instruments an event you choose, and checks that your project is receiving data.
- Package install. You add the SDK yourself with your package manager (npm install @amplitude/unified, pip install amplitude-analytics, or flutter pub add amplitude_flutter) and write the initialization code.
- The Amplitude CLI. amp is a command-line client for Amplitude's Developer API. Your SDK instruments the app; amp sets up and administers the objects around it, such as projects, taxonomy, feature flags, saved charts, and destinations. Coding agents also use it to fetch Amplitude's setup instructions.
Here's how that plays out for a small team. One engineer pastes the setup prompt into Claude Code on Friday afternoon, approves the diff, and sees events arriving before the end of the day. On Monday, a teammate scripts the team's feature flags with amp so new environments get the same setup every time.
Set up Amplitude with a coding agent
Agentic Setup gives your coding agent stack-specific instructions for adding Amplitude to a web, mobile, or backend app. The agent inspects your existing codebase, instruments one meaningful event, and checks whether your project is receiving data. For supported frameworks, it also turns on automatic event tracking and session replay.
You start Agentic Setup from your project's Setup page in Amplitude. To run it:
- In Amplitude, open your project's Setup page.
- Select the coding-agent setup option and copy the generated prompt.
- Open your app's repository in your coding agent and paste the prompt.
- Review the app root, project, region, and candidate events that the agent identifies.
- Pick one meaningful event from your app. The agent fetches the matching setup skill and implements the SDK integration for that event.
- Run the app and perform the action that triggers the event when the agent asks you to.
- Let the agent run its ingestion check, then review the changes before you commit them.
Behind the scenes, the agent uses the Amplitude CLI to fetch a maintained setup skill for your data region. In the US region, that command is:
amp skills get integrating-amplitude --region us
After you trigger the event, the agent runs a bounded ingestion check with your project API key:
amp events check-ingestion-by-api-key --api-key <PROJECT_API_KEY> --region us --timeout-seconds 60
Agentic Setup only needs your public, ingestion-scoped project API key. It doesn't need an Amplitude Secret Key or a CLI login, and you should never paste a Secret Key into the agent for this workflow. The full walkthrough lives in Set up Amplitude with a coding agent.
Working on a JavaScript web app and want a lighter-weight install? The Amplitude Quickstart also includes a ready-made AI prompt that you can paste into Cursor, Claude Code, Copilot, or another assistant that can edit your project.
Framework-specific setup examples
The commands you run depend on your stack. Here's what setup looks like for the most common builder frameworks, using the install steps from the Amplitude Quickstart.
Next.js
Next.js renders on the server, so the main thing to get right is where Amplitude initializes. The Quickstart AI prompt tells your coding agent to run the implementation only on the client, initialize Amplitude once during app load, install the correct browser package, enable autocapture and session replay, turn on remote config, and keep your existing TypeScript and framework patterns. If you'd rather write it yourself, install the Browser Unified SDK and call initAll once from a client-side entry point.
React (single-page app)
For React apps built with Vite or a custom setup, install the Browser Unified SDK from your project directory:
npm install @amplitude/unified
Then call initAll("AMPLITUDE_API_KEY") once when the app starts, and use track("Button Clicked", { buttonId: "signup" }) anywhere you want a custom event. The Unified SDK includes analytics, session replay, feature experimentation, and guides and surveys through one API. Session replay turns on when you set sessionReplay.sampleRate to a value above zero.
Python (Django and Flask)
Install the Python SDK with pip install amplitude-analytics, create one Amplitude("AMPLITUDE_API_KEY") client when your app starts, and send events with BaseEvent and a user_id. Because Django and Flask apps run business logic on the server, server-side events are the place to track things like sign-ups, logins, and completed transactions.
Flutter
Add the Flutter SDK with flutter pub add amplitude_flutter, create an Amplitude instance with your API key in a Configuration, wait for amplitude.isBuilt, and call amplitude.track(BaseEvent('Button Clicked')) for your first event.
Using Amplitude with AI coding agents
Amplitude works inside the AI coding tools builders already use, so you can set up and query analytics without switching to a browser.
Claude Code. Install the Amplitude plugin from the Amplitude MCP marketplace with /plugin marketplace add amplitude/mcp-marketplace, then /plugin install amplitude@amplitude. The plugin adds skills such as create-chart, create-dashboard, instrument-events, replay-ux-audit, and weekly-brief.
Cursor and other MCP clients. Connect the Amplitude MCP server to ask questions like "what's my conversion rate this week" from your editor. Setup uses OAuth and takes about two minutes per client. Cursor supports a one-click install.
Scripts and CI. Use amp where a conversational interface isn't the right fit. For non-interactive environments, amp auth pat --with-token saves an existing Personal Access Token as a profile instead of running the browser login.
Manage Amplitude with the Amplitude CLI
The Amplitude CLI is a command-line client for the Developer API. Every command maps to an API operation, so anything you do in a terminal you can also do in a script, a CI job, or an agent's shell. You need Node.js installed to run it.
To go from a fresh install to your first feature flag:
npm install -g @amplitude/developer-cli
amp auth login --region us
amp context
amp projects list
amp flags create --project <project_id> --key my-flag --name "My Flag"
amp auth login uses an OAuth device flow, so you approve the request in your browser. In an interactive terminal, list commands print readable tables. Pipe the output or pass --json and you get compact API JSON instead, which is easier for scripts and agents to parse. To try a command without a global install, run npx @amplitude/developer-cli help. The CLI quickstart covers each step.
Verifying your setup
Verification works a little differently depending on how you set up.
If you used Agentic Setup, the agent's ingestion check reports whether your project received any recent event. It doesn't confirm which event arrived or how many times. If the check doesn't see data, open the live event feed on your project's Setup page to confirm the event you picked.
To verify manually or debug later:
- Open the Amplitude Debugger. It shows events arriving in real time, including event names, properties, user IDs, and timestamps.
- Fire a few actions in your app (click a button, move between pages, submit a form) and confirm the matching events appear.
- Create your first chart so you can see the data you're collecting.
If events aren't showing up, check three things first: the API key matches the project you're looking at, the data region matches (EU projects use the EU endpoints), and Amplitude initializes once in the right app and runtime.
Coding agent vs. SDK install vs. script tag
A coding agent is the most hands-off path for an existing codebase, but it's not the only option. Here's when to use each approach with Amplitude Analytics.
For manual setup, see the Amplitude Quickstart or the SDK documentation for your platform.
Get started with Amplitude from your terminal
Setting up analytics is the one thing standing between building your product and understanding how people use it. Paste the setup prompt into your coding agent, or install the SDK with one command and initialize it with your project API key.
Try Amplitude for free today to set up analytics from your terminal and see your first events in minutes.
Amplitude is the leading all-in-one analytics platform for building better products. Product and engineering teams use Amplitude to connect product analytics and web analytics with session replay, heatmaps, experimentation, feature flags, and guides and surveys in one unified workflow, with AI agents working across all of it. Learn how Amplitude is building self-improving products with Wave, helping teams turn product data into PRs.
Frequently asked questions about terminal setup
Yes. With Agentic Setup, the agent shows you the app root, project, and region it identified before it changes anything, so you can point it at the right package, such as web/ for your browser app or backend/ for Node. With a manual install, add the SDK to each app that sends events and initialize it once per runtime.
No. You can install an Amplitude SDK and start sending data on the Free plan, which includes 2M events a month with full platform access, including session replay, feature experimentation, and guides and surveys. Setup only needs the public project API key from your project settings, and Agentic Setup uses that same public, ingestion-scoped key, so you never hand a Secret Key to your coding agent.
You stay in control. In Agentic Setup, the agent lists candidate events and you pick the one it instruments. When it's done, it offers to commit the changes, and you review the diff and test the app before approving. Nothing lands in your repository without your sign-off.
Yes. The Amplitude CLI is built for scripts and CI as well as interactive terminals. Authenticate with a Personal Access Token using amp auth pat --with-token, and pass --json to get raw API output your pipeline can parse. Use it to manage projects, taxonomy, feature flags, and destinations as part of automated workflows.
Yes. Agentic Setup supports client-side, server-side, and native stacks without asking the agent to choose an SDK from general documentation. For a manual install, Amplitude has server SDKs for Node.js (npm install @amplitude/analytics-node) and Python (pip install amplitude-analytics), plus the HTTP API for any environment that can make requests.
For a website, the script tag is the fastest browser install: paste it into your head tag, add your API key, and load a page. For an app with a codebase, paste Amplitude's setup prompt into your coding agent. Either way, most implementations take under 10 minutes from install to seeing your first events.