⚡ 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 →
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.
🏁 Before you begin, Create your Amplitude account and project
If you don’t have an Amplitude account yet:- Go to amplitude.com and sign up for a free account
- After signing in, click Create new project and give it your app’s name
- Amplitude shows your API Key on the welcome screen, keep this tab open, you’ll need it in Step 1
- Your Project ID is at Settings → Projects → select your project → Project ID — you’ll need it in Step 3
🎯 Step 1 — Install the Amplitude SDK in your app
Open a terminal in your frontend app’s directory (the folder that contains yourpackage.json) and run:
@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
Callamplitude.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):
📺 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:
- Open your app in a browser
- Navigate to a few pages, click some buttons, and perform a typical user action
- In Amplitude, go to Activity → Live Events and confirm events are arriving
📝 Step 3 — Register your product with Autoplay
📺 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:
- Mac / Linux
- Windows (PowerShell)
- 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 asAuthorization: Bearer <ingest_secret> - mcp_url:
https://mcp.autoplay.ai/mcp - mcp_key:
{secret}— your agent’s Bearer token
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)
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
Amplitude uses a developer portal to create custom event streaming destinations.
5a — Open the destination builder
- In Amplitude, click Data in the left sidebar
- In the left sub-navigation, click Destinations
- Click + Add Destination (top right)
- In the catalog that opens, search for “HTTP” or scroll to find it, then select it
- Choose “Event Streaming” as the type
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.
- Enable the “Send Events” toggle
- Under “Select & filter events”, keep it set to “All Events”
- Click “Test Connection” to send a test event and confirm you get a
200 OK - Click “Release” (top right) — this publishes the destination to the catalog
- Go back to Data → Destinations
- Under “New Destinations”, find your destination
- Click it → “Add New Sync” page opens
- Enter a Sync Name (e.g.,
production-stream) and click “Create Sync”
📡 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 themcp_key from Step 3:
YOUR_USER_ID— the stable id you pass toamplitude.setUserId(...).YOUR_MCP_KEY— themcp_keyprinted by Step 3.
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.401: Confirm Amplitude’s destinationAuthorizationheader isBearer <ingest_secret>(from Step 3) and the destination URL is youringest_url(/ingest/YOUR_AMPLITUDE_PROJECT_ID).404/ empty activity: ConfirmYOUR_AMPLITUDE_PROJECT_IDmatches theproduct_idyou passed toonboard_productin Step 3, and that you’re querying the sameuser_idyou set viasetUserId.- Events in Amplitude Live Events but not landing: Confirm the sync is active and the Event Body template uses
event_type(notevent_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:ActionsPayload surfaces:
session_id—"1749012345678"(stringified)user_id— the top-level id fromamplitude.setUserId(...)(what the connector keys activity by);email— fromuser_propertiesset viaamplitude.identify()actions— extracted page view actions withcanonical_url,title, anddescription
⚠️ Common mistakes
Sending events to the wrong URL. Always point the Amplitude destination at youringest_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.