On this page

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

Set up Amplitude with an AI coding assistant

For engineers who use AI coding tools5 minBeginner

An AI prompt is a low-code way to set up the Amplitude Browser SDK in a JavaScript web app. Copy the prompt into an AI coding tool, and the tool makes the code changes for you. Use this option when you want an AI tool to make the code changes instead of running a full manual install.

The prompt sets up:

To have an AI agent also read your codebase and choose which events to instrument, use the Amplitude Wizard CLI instead.

Prerequisites

  • An Amplitude project and its API key. Create a free Amplitude account if you still need one.
  • An AI coding assistant that can edit your project.

Run the setup prompt

  1. Copy

    Copy the prompt into your AI tool

    Paste it into Cursor, Claude Code, Copilot, or another coding assistant that can edit your project. Click the API key button in the code block to insert your key before you copy the prompt.

    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

    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

    Verify that events arrive

    After the changes land, open the Amplitude Debugger and confirm that page views and session data reach your project.

Was this helpful?