# Amplitude Quickstart

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Amplitude is quick to set up. Most implementations take under 10 minutes from install to seeing your first events. Pick your platform below and follow a few steps.

Not finding your platform? [Browse all Amplitude SDKs](https://amplitude.com/docs/sdks).

## Pick your platform

#### JavaScript

Amplitude offers several ways to instrument a JavaScript web app. Choose the method that fits your workflow.

#### Snippet

### Install the Browser SDK with a snippet

Paste-and-go install for websites. Add this script to the `<head>` of your site when you want the fastest possible browser install with no build step or npm package.

> **Tip:** Set up with a browser snippet
>
> Use this option for static sites, CMS-driven sites, or any project where a script tag is easier than an SDK install.

Script-tag install with no bundler.

[Autocapture](https://amplitude.com/docs/data/autocapture) and [Session Replay](https://amplitude.com/docs/session-replay).

Remote config for feature flags.

1. **Paste the snippet into your site's \`<head>\`**

   Add it to every page you want to track.

   ```html
   <script src="https://cdn.amplitude.com/script/AMPLITUDE_API_KEY.js"></script>
   <script>
     window.amplitude.add(window.sessionReplay.plugin({ sampleRate: 1 }));
     window.amplitude.init("AMPLITUDE_API_KEY", {
       fetchRemoteConfig: true,
       autocapture: {
         attribution: true,
         fileDownloads: true,
         formInteractions: true,
         pageViews: true,
         sessions: true,
         elementInteractions: true,
         networkTracking: true,
         webVitals: true,
         frustrationInteractions: true,
       },
     });
   </script>
   ```
2. **Set your API key and load the page**

   Replace the placeholder with your project's API key, then load a tracked page in your browser.
3. **Confirm data in Amplitude**

   Open the [Amplitude Debugger](https://amplitude.com/docs/analytics/debug-analytics) and check for page view, session, and interaction events.

**Tips**

- Click the **API key** button in the code block to insert your key before you copy the snippet.
- Use the EU CDN host if your project uses EU data residency.
- Create a [free Amplitude account](https://app.amplitude.com/signup) if you need a project and API key.

#### npm

### Install the Browser SDK with npm

1. **Install the Browser Unified SDK**

   Run this command in your project directory:

   ```bash
   npm install @amplitude/unified
   ```
2. **Initialize Amplitude at app load**

   Import and call `initAll` once when your app starts:

   ```javascript
   import { initAll } from "@amplitude/unified";

   initAll("AMPLITUDE_API_KEY");
   ```
3. **Track your first event**

   Call `track` anywhere in your app:

   ```javascript
   import { track } from "@amplitude/unified";

   track("Button Clicked", { buttonId: "signup" });
   ```

For full configuration options, see [Browser Unified SDK](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk).

#### yarn

### Install the Browser SDK with yarn

1. **Install the Browser Unified SDK**

   Run this command in your project directory:

   ```bash
   yarn add @amplitude/unified
   ```
2. **Initialize Amplitude at app load**

   Import and call `initAll` once when your app starts:

   ```javascript
   import { initAll } from "@amplitude/unified";

   initAll("AMPLITUDE_API_KEY");
   ```
3. **Track your first event**

   Call `track` anywhere in your app:

   ```javascript
   import { track } from "@amplitude/unified";

   track("Button Clicked", { buttonId: "signup" });
   ```

For full configuration options, see [Browser Unified SDK](https://amplitude.com/docs/sdks/analytics/browser/browser-unified-sdk).

#### AI Prompt

### Set up with an AI prompt

Low-code setup with an AI assistant. Copy this prompt into an AI coding tool to set up the Amplitude Browser SDK for a JavaScript web app without running a full manual install.

> **Tip:** Set up with an AI prompt
>
> Use this option when you want an AI tool to make the code changes for you.

Full SDK setup for a JavaScript web app.

[Autocapture](https://amplitude.com/docs/data/autocapture) and [Session Replay](https://amplitude.com/docs/session-replay).

Remote config for feature flags and guides.

1. **Copy the prompt into your AI tool**

   Paste it into Cursor, Claude Code, Copilot, or another coding assistant that can edit your project.

   ```text
   Install and configure Amplitude for this JavaScript web application.

   Use API key: AMPLITUDE_API_KEY

   Requirements:
   - Run the implementation only on the client.
   - Initialize Amplitude once during app load.
   - Install the correct browser package for this project.
   - Enable fetchRemoteConfig: true.
   - Enable autocapture for attribution, page views, sessions, element interactions, form interactions, and file downloads.
   - Enable Session Replay with sampleRate: 1.
   - Preserve the project's existing TypeScript and framework patterns.
   ```
2. **Review the generated changes**

   Confirm that the assistant installed the SDK, initialized it in the right client entry point, and kept the code client-side.
3. **Verify that events arrive**

   After the changes land, open the [Amplitude Debugger](https://amplitude.com/docs/analytics/debug-analytics) and confirm that page views and session data reach your project.

**Tips**

- Click the **API key** button in the code block to insert your key before you copy the prompt.
- Create a [free Amplitude account](https://app.amplitude.com/signup) if you still need a project and API key.

#### iOS

### Install the iOS SDK

1. **Add the SDK to your Xcode project**

   Choose Swift Package Manager or CocoaPods.

   **Swift Package Manager:** In Xcode, navigate to _File > Add Package Dependencies_ and enter:

   ```text
   https://github.com/amplitude/Amplitude-Swift
   ```

   **CocoaPods:** Add to your `Podfile`, then run `pod install`:

   ```ruby
   pod 'AmplitudeSwift', '~> 1.0'
   ```
2. **Initialize the SDK**

   Add this to your app delegate or `@main` entry point:

   ```swift
   import AmplitudeSwift

   let amplitude = Amplitude(configuration: Configuration(
       apiKey: "AMPLITUDE_API_KEY"
   ))
   ```
3. **Track your first event**

   ```swift
   amplitude.track(eventType: "Button Clicked")
   ```

For full configuration options including Autocapture, see [iOS Swift SDK](https://amplitude.com/docs/sdks/analytics/ios/ios-swift-sdk).

#### Android

### Install the Android SDK

1. **Add the SDK dependency**

   Add this to your `build.gradle`:

   ```gradle
   dependencies {
       implementation 'com.amplitude:analytics-android:1.+'
   }
   ```
2. **Initialize the SDK**

   Add this to your `Application` class or main `Activity`:

   ```kotlin
   import com.amplitude.android.Amplitude

   val amplitude = Amplitude(AMPLITUDE_API_KEY, applicationContext)
   ```
3. **Track your first event**

   ```kotlin
   amplitude.track("Button Clicked")
   ```

For full configuration options including Autocapture, see [Android Kotlin SDK](https://amplitude.com/docs/sdks/analytics/android/android-kotlin-sdk).

#### Node.js

### Install the Node.js SDK

1. **Install the SDK**

   ```bash
   npm install @amplitude/analytics-node
   ```
2. **Initialize Amplitude at startup**

   ```javascript
   import { init, track } from "@amplitude/analytics-node";

   init("AMPLITUDE_API_KEY");
   ```
3. **Track your first event**

   ```javascript
   track("Button Clicked", undefined, { user_id: "user@example.com" });
   ```

For full configuration options, see [Node.js SDK](https://amplitude.com/docs/sdks/analytics/node/node-js-sdk).

#### React Native

### Install the React Native SDK

1. **Install the SDK and its dependency**

   ```bash
   npm install @amplitude/analytics-react-native
   npm install @react-native-async-storage/async-storage
   ```
2. **Initialize Amplitude at app load**

   ```javascript
   import { init, track } from "@amplitude/analytics-react-native";

   init("AMPLITUDE_API_KEY");
   ```
3. **Track your first event**

   ```javascript
   track("Button Clicked");
   ```

For full configuration options, see [React Native SDK](https://amplitude.com/docs/sdks/analytics/react-native/react-native-sdk).

#### Python

### Install the Python SDK

1. **Install the SDK**

   ```bash
   pip install amplitude-analytics
   ```
2. **Initialize the client**

   ```python
   from amplitude import Amplitude, BaseEvent

   amplitude = Amplitude("AMPLITUDE_API_KEY")
   ```
3. **Track your first event**

   ```python
   amplitude.track(BaseEvent(
       event_type="Button Clicked",
       user_id="user@example.com"
   ))
   ```

For full configuration options, see [Python SDK](https://amplitude.com/docs/sdks/analytics/python/python-sdk).

#### Flutter

### Install the Flutter SDK

1. **Add the SDK to your project**

   ```bash
   flutter pub add amplitude_flutter
   ```
2. **Initialize the SDK in your app**

   ```dart
   import 'package:amplitude_flutter/amplitude.dart';
   import 'package:amplitude_flutter/configuration.dart';

   final Amplitude amplitude = Amplitude(Configuration(
       apiKey: 'AMPLITUDE_API_KEY',
   ));
   await amplitude.isBuilt;
   ```
3. **Track your first event**

   ```dart
   amplitude.track(BaseEvent('Button Clicked'));
   ```

For full configuration options, see [Flutter SDK](https://amplitude.com/docs/sdks/analytics/flutter/flutter-sdk-4).

#### HTTP

### Send events via HTTP

Send events directly to the Amplitude HTTP API without an SDK. This works in any environment that can make HTTP requests.

1. **Send your first event**

   Make a POST request with your API key and event data:

   ```bash
   curl -X POST https://api2.amplitude.com/2/httpapi \
     -H "Content-Type: application/json" \
     -d '{
       "api_key": "AMPLITUDE_API_KEY",
       "events": [{
         "user_id": "user@example.com",
         "event_type": "Button Clicked"
       }]
     }'
   ```

   For EU data residency, use `https://api.eu.amplitude.com/2/httpapi` instead.

See the [HTTP API Quickstart](https://amplitude.com/docs/apis/analytics/http-api-quickstart) and [HTTP API Reference](https://amplitude.com/docs/apis/analytics/http-v2) for full request options and error handling.

---

## Take the next step

After data starts flowing, use these guides to expand your implementation.

### [Amplitude MCP server](https://amplitude.com/docs/amplitude-ai/amplitude-mcp)

Query your analytics data from Claude, Cursor, or any other MCP-compatible client without leaving your workflow.

### [Claude Code plugin](https://github.com/amplitude/mcp-marketplace/tree/main/plugins/amplitude)

Install the Amplitude plugin for Claude Code to get built-in slash commands for charts, dashboards, and instrumentation work.

### [Custom events](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#track-an-event)

Track the product events that matter to your business after Autocapture covers the basics.

### [User identification](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#custom-user-identifier)

Connect anonymous activity to known users so you can analyze behavior across sessions and devices.

### [Group analytics](https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2#user-groups)

Analyze behavior at the account, workspace, or team level with user groups.

### [Session Replay](https://amplitude.com/docs/session-replay)

Watch real user sessions alongside event data to find friction, confusion, and drop-off points.
