Skip to main content

⚡ Add this skill

One command

Add the Autoplay Amplitude session replay provider skill for an existing Amplitude setup.
View the docs →

Agent onboarding

Fetch this skill when a customer already uses Amplitude as a session replay provider and wants Autoplay live user activity.
View the skill →
Prerequisite: install the SDK first — see Quickstart.

Let an AI agent do this for you

Use the Amplitude agent skill to wire up the full integration autonomously — SDK install, identify wiring, server-side proxy, and CSP headers.
If you already use Amplitude to capture events, skip to Step 3 to register your product with Autoplay, then Step 4 to identify on login, and Step 5 to create the event streaming destination.

🏁 Before you begin, Create your Amplitude account and project

If you don’t have an Amplitude account yet:
  1. Go to amplitude.com and sign up for a free account
  2. After signing in, click Create new project and give it your app’s name
  3. Amplitude shows your API Key on the welcome screen, keep this tab open, you’ll need it in Step 1
  4. Your Project ID is at Settings → Projects → select your project → Project ID — you’ll need it in Step 3
When you first log in, Amplitude shows a “Let’s get set up!” screen with “Waiting for your events…” at the bottom. You cannot access Data → Destinations until this screen is dismissed. To dismiss it: complete Steps 1–3 below to send your first events, then click “Finish Setup” — or click “Skip for now” in the bottom-right to go straight to the dashboard.

🎯 Step 1 — Install the Amplitude SDK in your app

Open a terminal in your frontend app’s directory (the folder that contains your package.json) and run:
The Unified SDK (@amplitude/unified) bundles Analytics and Session Replay in one package. Session Replay lets Autoplay correlate what users actually did on screen with your support AI agent conversations. 📺 Full setup walkthrough

💻 Step 2 — Initialize on app load

This step is required before you can create a destination in Step 5. Amplitude only shows the Data → Destinations section and the destination catalog after it has received at least one live event from your app. If you skip or fail to complete this step, the catalog will be empty and you will not be able to add a destination.
Call amplitude.initAll() once at app startup — in main.ts, _app.tsx, or your root layout. Replace YOUR_AMPLITUDE_API_KEY with your project’s API key (see the Tip below for where to find it):
Where to find your Amplitude API key: In Amplitude, go to Settings → Projects → [Your Project] → General. Copy the API Key shown there. It’s also displayed on the onboarding wizard screen under “Your API Key”.
📺 Copy your Amplitude API key
autocapture: true ensures that page views, clicks, and session lifecycle events flow to Autoplay automatically. Session Replay records what users actually do — Autoplay correlates those sessions to give your support AI agent real-time context. After adding the code above, interact with your app to send Amplitude its first events:
  1. Open your app in a browser
  2. Navigate to a few pages, click some buttons, and perform a typical user action
  3. In Amplitude, go to Activity → Live Events and confirm events are arriving
Once Amplitude shows your events, the “Finish Setup” button at the bottom of the onboarding screen activates, click it to reach the main dashboard. You can then proceed to Step 3.

📝 Step 3 — Register your product with Autoplay

Where to find your Amplitude Project ID: In Amplitude, go to Settings → Projects → select your project → Project ID. Copy the numeric ID shown there — you’ll use it as YOUR_AMPLITUDE_PROJECT_ID below.
📺 How to find your Amplitude Project ID
This script registers your product and prints the credentials you’ll need in Steps 4 and 6. Create the registration script — in your project root, create a file called register.py:
Run it once (make sure your venv is active):
This will print the following fields:
  • product_id: YOUR_AMPLITUDE_PROJECT_ID
  • provider: amplitude
  • ingest_url: https://connector.autoplay.ai/ingest/YOUR_AMPLITUDE_PROJECT_ID
  • ingest_secret: {secret} — Amplitude sends this as Authorization: Bearer <ingest_secret>
  • mcp_url: https://mcp.autoplay.ai/mcp
  • mcp_key: {secret} — your agent’s Bearer token
Save what prints in the terminal — you will need ingest_url and ingest_secret in Step 5, and mcp_key in Step 6.
Re-registering your productA second onboard_product with the same product_id returns 409 until overwrite is allowed. Pass force=True to overwrite. You must still pass contact_email on every registration, including overwrites.

👤 Step 4 — Identify on login (required for session scoping)

Add this to your auth/login handler — wherever your app handles a successful login. setUserId is the key step: it stamps every event with a stable user_id, and the connector keys a user’s activity under exactly that id — the same one your agent will look them up by.
  • YOUR_AMPLITUDE_PROJECT_ID — your Amplitude project ID from Step 3 (e.g. 828048)
Without setUserId, events carry only a device_id — the connector still records activity, but keyed by device_id, so your agent won’t find the user by their real id. Always call setUserId on login.
On logout — reset so the next user starts clean:
About session IDs: Amplitude assigns each session a numeric Unix-millisecond timestamp as its ID. The connector converts it to a string automatically. If session_id is -1 in very early events, the connector falls back to device_id until the session resolves (a few seconds).

⚙️ Step 5 — Create the event streaming destination in Amplitude

You’ll need two values printed by Step 3:
  • URL: ingest_url (e.g. https://connector.autoplay.ai/ingest/YOUR_AMPLITUDE_PROJECT_ID)
  • Bearer token: ingest_secret
📺 How to create the Amplitude event streaming destination
Amplitude uses a developer portal to create custom event streaming destinations. 5a — Open the destination builder
  1. In Amplitude, click Data in the left sidebar
  2. In the left sub-navigation, click Destinations
  3. Click + Add Destination (top right)
  4. In the catalog that opens, search for “HTTP” or scroll to find it, then select it
  5. Choose “Event Streaming” as the type
5b — Fill in the Configuration tab Integration Name — give the destination a name, e.g. autoplay-connector. URL Endpoint Create Parameters — click “Add New Parameter” and add: REST API Headers — click “Add New REST API Header” and set: Event Body Editor — replace the default Freemarker template with:
This template does two things the default Amplitude template does not:1. Event type normalisation — Amplitude’s autocapture sends events with names like [Amplitude] Page Viewed and [Amplitude] Element Clicked. The Autoplay connector needs these mapped to standard names it recognises. The template does that automatically:2. Field mapping — Amplitude stores click details (element text, URL, element path) under its own field names. The template copies them into the fields Autoplay expects so it can generate human-readable descriptions like “User clicked Sign Up button on the dashboard page”.Without this template, only page views appear in the Autoplay stream — clicks and form events are silently ignored.
Click “Next” to proceed to the Testing tab. 5c — Configure and release on the Testing tab
  1. Enable the “Send Events” toggle
  2. Under “Select & filter events”, keep it set to “All Events”
  3. Click “Test Connection” to send a test event and confirm you get a 200 OK
  4. Click “Release” (top right) — this publishes the destination to the catalog
5d — Create a sync from the published destination
  1. Go back to Data → Destinations
  2. Under “New Destinations”, find your destination
  3. Click it → “Add New Sync” page opens
  4. Enter a Sync Name (e.g., production-stream) and click “Create Sync”
The sync is now active. Amplitude will stream all events to your connector endpoint in real time.

📡 Step 6 — See your activity land

Everything is wired up! The connector is pull-based — you (or your agent) fetch a user’s recent activity the moment you need it. Click around your app while logged in as an identified user, then pull that user’s activity with the mcp_key from Step 3:
  • YOUR_USER_ID — the stable id you pass to amplitude.setUserId(...).
  • YOUR_MCP_KEY — the mcp_key printed by Step 3.
A 200 with a populated actions array means your events are flowing. An empty array means events haven’t landed yet — click around and give it a few seconds.
This REST call returns the exact same data your agent reads over MCP (the get_live_user_activity tool). See the MCP server page to connect your agent.
Common issues:
  • 401: Confirm Amplitude’s destination Authorization header is Bearer <ingest_secret> (from Step 3) and the destination URL is your ingest_url (/ingest/YOUR_AMPLITUDE_PROJECT_ID).
  • 404 / empty activity: Confirm YOUR_AMPLITUDE_PROJECT_ID matches the product_id you passed to onboard_product in Step 3, and that you’re querying the same user_id you set via setUserId.
  • Events in Amplitude Live Events but not landing: Confirm the sync is active and the Event Body template uses event_type (not event_name) inside {"events": [...]}.
  • No events in Amplitude Live Events: Confirm the sync “Send Events” toggle is on and that you are calling amplitude.setUserId() before tracking events.
👋 Quick Tip: Once you add this code to your site, jump into our Discord and say hi — we will check your data is flowing and help you get fully set up!

📦 What the payload looks like

A sample Amplitude event that Autoplay receives:
After normalization, ActionsPayload surfaces:
  • session_id"1749012345678" (stringified)
  • user_id — the top-level id from amplitude.setUserId(...) (what the connector keys activity by); email — from user_properties set via amplitude.identify()
  • actions — extracted page view actions with canonical_url, title, and description

⚠️ Common mistakes

Sending events to the wrong URL. Always point the Amplitude destination at your ingest_url (/ingest/{product_id}) with Authorization: Bearer <ingest_secret>. The product_id lives in the URL path — you don’t set it on the event. Not calling amplitude.setUserId() on login. This is the call that stamps the top-level user_id the connector keys activity by. Without it, events carry only a device_id and your agent can’t find the user by their real id. amplitude.identify() (email / name) is optional enrichment on top. Session ID is −1 in early events. Amplitude initializes session_id to −1 briefly before the first session is established. Autoplay falls back to device_id for these events, which is still a valid scoping key. This is normal and resolves within a few seconds of page load. Not calling amplitude.init() before the chat widget opens. If the chat widget fires GET /sessions/{product_id}/{session_id} before Amplitude’s session is established, there will be no activity to return. Initialize Amplitude at the earliest possible point in your app lifecycle.

🔌 Next: connect your AI support agent

Your activity is now flowing into the connector. Head back to Quickstart to choose your existing AI support agent and connect it via MCP — it then pulls a user’s live activity on demand, the moment it needs context to answer.

Choose your AI support agent

Fin (Intercom), Maven, Ada, Botpress, and more — pick yours and connect via MCP.