# Configure Content Security Policy for the Subtext Capture Snippet Source: https://subtext.fullstory.com/docs/api/csp Allow the Subtext capture snippet's script and network requests through your app's Content Security Policy. If your app sends a `Content-Security-Policy`, it blocks the capture snippet's script from loading and the SDK's network calls from reaching Fullstory until your policy allows them. You need to allow both Fullstory hosts across three directives — `script-src`, `connect-src`, and `img-src`. Update the policy before you [install the snippet](/docs/install/overview) so capture works from the first page load. Update the policy before you install the snippet. If you leave a restrictive policy in place, capture silently fails — the script never loads and no errors surface to your users. ## Where CSP lives Look for the policy in these places: * Framework config — `next.config.js` (`headers()`), `vercel.json`, `netlify.toml` `[[headers]]` blocks. * Middleware — Express/Fastify `helmet`, Next.js `middleware.ts`, custom response-header middleware. * HTML meta tag — `` in the HTML entry point. * Hosting platform — Vercel/Netlify/Cloudflare dashboard or Workers script. ## Required directives ### `script-src` Add both Fullstory hosts. The snippet runs an inline bootstrap, so you also need `'unsafe-inline'` — or a nonce. ``` script-src 'self' https://edge.fullstory.com https://rs.fullstory.com 'unsafe-inline'; ``` If you already use nonces, prefer that approach: ``` script-src 'self' https://edge.fullstory.com https://rs.fullstory.com 'nonce-'; ``` Then add the nonce to the snippet's ` ``` The snippet loads `fs.js` from Fullstory's edge asynchronously. It does not block rendering and adds no measurable overhead to page load time. The plugin is the fastest way to connect an agent: it configures the MCP server connection and installs the Subtext skills and commands in one step, and it updates automatically. **Claude Code** (full plugin — MCP server, skills, and commands): ```text theme={null} /plugin marketplace add fullstorydev/subtext /plugin install subtext@subtext-marketplace ``` **Cursor** — install [Subtext from the Cursor marketplace](https://cursor.com/marketplace/subtext) directly inside Cursor. **Codex** — open `/plugins` and install **subtext** from the repo marketplace. **Gemini CLI**: ```bash theme={null} gemini extensions install https://github.com/fullstorydev/subtext ``` **Windsurf and other editors** — install the skills via [OpenSkills](https://github.com/fullstorydev/subtext), then add the MCP server manually in the next step: ```bash theme={null} npx openskills install fullstorydev/subtext npx openskills sync ``` **claude.ai** — Subtext is also available as a connector in the [Claude directory](https://claude.ai/directory/connectors/subtext). If you installed the plugin for Claude Code, Cursor, Codex, or Gemini CLI, the MCP server is configured for you — skip the next step and go straight to verification. If your tool didn't configure MCP servers automatically during installation, add the server by hand. Subtext's MCP server is hosted — `https://api.fullstory.com/mcp/subtext` over HTTP, with no local process to run. Add the server URL without any headers — your tool handles the OAuth flow automatically. ```json Claude Code (~/.claude/settings.json) theme={null} { "mcpServers": { "subtext": { "type": "http", "url": "https://api.fullstory.com/mcp/subtext" } } } ``` ```json Cursor (Settings → MCP → Add Server) theme={null} { "subtext": { "type": "http", "url": "https://api.fullstory.com/mcp/subtext" } } ``` Get your API key from [Settings → API Keys](https://app.fullstory.com/ui/org/settings/apikeys) and pass it as a Bearer token header. ```json Claude Code (~/.claude/settings.json) theme={null} { "mcpServers": { "subtext": { "type": "http", "url": "https://api.fullstory.com/mcp/subtext", "headers": { "Authorization": "Bearer YOUR_SUBTEXT_API_KEY" } } } } ``` ```json Cursor (Settings → MCP → Add Server) theme={null} { "subtext": { "type": "http", "url": "https://api.fullstory.com/mcp/subtext", "headers": { "Authorization": "Bearer YOUR_SUBTEXT_API_KEY" } } } ``` Keep your API key private. Do not commit it to source control. If you are working in a team environment, use environment variable injection or a secrets manager rather than hardcoding the key in a shared config file. Any tool that accepts a remote MCP URL — Linear's **Custom URL…** field, for example — takes the same endpoint directly. Once saved, restart your agent or reload its MCP configuration. With the snippet deployed and your agent connected, run through this checklist to confirm everything is working end to end: **Capture is working:** 1. Open your application in a browser and navigate to a few pages. 2. Go to **Subtext → Sessions**. A new session should appear within 60 seconds. 3. Click into the session and confirm you can see a replay timeline with page events. **MCP server is reachable:** 1. Open your agent (Claude Code, Cursor, etc.) in the project where you installed the plugin or added the MCP config. 2. Ask it: *"List my recent Subtext sessions."* 3. The agent should respond with a list of sessions from your account. If it returns an authentication error, redo the OAuth flow (or check the Bearer token value), and confirm the config file is in the correct location for your agent. **Skills are available:** 1. In your agent, type `/` and look for Subtext skills in the command list (e.g., `/subtext:subtext-review`, `/subtext:subtext-session`). 2. If they do not appear, reinstall the plugin (or re-run `npx openskills sync`) and restart your agent. If sessions appear in the Subtext dashboard but the MCP server cannot be reached, the most common cause is a misplaced or malformed MCP config file. Check that the JSON is valid (no trailing commas) and that the file path matches what your agent expects. The capture snippet records full production sessions and masks all form inputs by default. Once your agent is connected, it can review sessions, flag additional PII, and propose masking rules for your approval — closing the privacy governance loop without manual scrubbing. # Install Subtext in a Next.js App Router Application Source: https://subtext.fullstory.com/docs/install/next-app-router Add the Subtext capture snippet to your Next.js App Router project by inserting it into app/layout.tsx using the Script component. The fastest way to add Subtext to a Next.js App Router project is to drop the capture snippet into your root layout file. Because `app/layout.tsx` wraps every route in your application, the snippet loads once and records sessions across your entire site. The ` {children} ); } ``` The `id` prop on `
``` Run `npm start` (Create React App) or `npm run dev` (Vite-based setups) and open your application in a browser. For production, rebuild with `npm run build` and deploy normally — the snippet is embedded in the static HTML shell. Navigate to a few pages in your app, then open **Subtext → Sessions**. A new session should appear within a minute or two. Sessions typically appear within 30–60 seconds of page load. If nothing shows up, confirm that `YOUR_ORG_ID` was replaced with your actual Org ID and that `public/index.html` is the HTML file being served by your development server. The snippet records full production sessions and masks all form inputs by default. Your agent can flag additional PII and propose masking rules for your review from within Subtext. # Install the Subtext Snippet in Your Remix Application Source: https://subtext.fullstory.com/docs/install/remix Add the Subtext capture snippet to your Remix app by inserting an inline script into your root route using dangerouslySetInnerHTML. In Remix, `app/root.tsx` is the single file that renders the full HTML document for every route in your application. It exposes a `` component that Remix uses to inject your app's JavaScript — and it is the right place to add the Subtext capture snippet so it loads on every page. You will add an inline ` ``` Replace `YOUR_ORG_ID` with the organisation ID from your Subtext dashboard. If you used the setup wizard, this replacement was made automatically. ## How to detect if the snippet is already installed Before adding the snippet, check whether your app already loads `fs.js`. Look for any of these signals: * Search your codebase for `edge.fullstory.com` or `_fs_org` — if either string appears, the snippet (or Fullstory's own snippet) is already present * Open your browser's Network tab, load a page, and filter by `fs.js` — a `200` response confirms capture is running * Check your `` template, root layout file, or tag manager configuration for a script referencing `fullstory.com` If the snippet is already present from a prior Fullstory install, Subtext can connect to those existing sessions — you do not need a second copy of the script. ## Framework installation guides Where exactly the snippet goes depends on your framework's rendering model. Click the guide for your stack: | Framework | Where the snippet lives | Guide | | ------------------------ | --------------------------------------------------- | ------------------------------------------------ | | **Next.js (App Router)** | `app/layout.tsx`, inside `` via next/script | [next-app-router](/docs/install/next-app-router) | | **React (CRA / custom)** | `public/index.html` ``, or a layout component | [react](/docs/install/react) | | **Vite** | `index.html` `` in the project root | [vite](/docs/install/vite) | | **Remix** | `app/root.tsx`, inside the `` export | [remix](/docs/install/remix) | | **Plain HTML / other** | Directly in your `` template | [manual](/docs/install/manual) | For Single Page Apps (React, Vite, Remix), the snippet only needs to appear once — in the root HTML shell. You do not need to add it to individual route components. Client-side navigations are tracked automatically as part of the session. ## Next steps Once the snippet is in place and you have deployed your app, sessions begin recording immediately. Your next step is connecting your AI coding agent to those sessions via the MCP server. See the [installation overview](/docs/install/overview) for the full picture, or jump straight to the MCP setup guide for your agent. # Install the Subtext Snippet in Your Vite Application Source: https://subtext.fullstory.com/docs/install/vite Add the Subtext capture snippet to a Vite project by inserting the script tag into your index.html file at the project root directory. Vite projects use an `index.html` at the project root as their application entry point — unlike Create React App, this file lives at the top level rather than inside `public/`. Pasting the Subtext capture snippet into its `` is all you need to start recording sessions across your entire application. You can also run `npx @subtextdev/subtext-wizard` in your project root to have Subtext detect your framework and insert the snippet automatically. Follow this guide if you prefer to wire things up by hand. Log in to Subtext and open **Settings**. Your Org ID is listed in the **Capture** section. Copy it — you will paste it in place of `YOUR_ORG_ID` in the snippet below. Open the `index.html` file in the root of your Vite project (the same directory as `vite.config.ts`). Do not confuse this with any `index.html` files that may exist inside subdirectories. Add the snippet inside the `` tag, just before the closing ``. Replace `YOUR_ORG_ID` with the Org ID you copied from Subtext settings. ```html index.html theme={null} My App
``` Vite treats `index.html` as the application entry point and processes it during both `dev` and `build`. The snippet will be included in your production build automatically — no extra configuration needed.
Start Vite with `npm run dev` and open your application in a browser. The snippet loads asynchronously and does not block rendering. Navigate to a few pages, then open **Subtext → Sessions**. A new session should appear within a minute or two. Sessions typically appear within 30–60 seconds of page load. If nothing shows up, confirm that `YOUR_ORG_ID` was replaced with your actual Org ID and that you edited the `index.html` at the project root, not one inside `src/` or `public/`.
The snippet records full production sessions and masks all form inputs by default. Your agent can flag additional PII and propose masking rules for your review from within Subtext. # Amplitude and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/amplitude Attach the Subtext session URL to Amplitude, then jump from any Amplitude signal — an anomaly alert, a dashboard email, a funnel drop — straight into the user's real session. Amplitude tells you *that* a metric moved and *who* it moved for: an onboarding rate slipped, activation dropped, a funnel leaks at one step. It can't show you the moment one specific person got stuck. Subtext can. Attach the Subtext session URL to your Amplitude data and every Amplitude signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Amplitude detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the Amplitude Browser SDK (`@amplitude/analytics-browser`) is initialized. ## Attach the session URL Store the current Subtext session URL on your Amplitude data so it travels with the signal. There are two places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the Amplitude user profile with the `Identify` class. Call it wherever your app already identifies the user — on auth resolution, not at module top level. Amplitude typically uses snake\_case for property names, but match whatever convention your project already uses. ```js analytics.js theme={null} import { identify, Identify } from '@amplitude/analytics-browser' const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { const identifyObj = new Identify() identifyObj.set('subtext_url', subtextUrl) identify(identifyObj) } ``` ```tsx React theme={null} import { identify, Identify } from '@amplitude/analytics-browser' useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { const identifyObj = new Identify() identifyObj.set('subtext_url', subtextUrl) identify(identifyObj) } }, [user]) ``` ### On every event An Amplitude enrichment plugin runs on every event, reading the URL fresh each time. Because `url.now` carries a timestamp, the link deep-links to the moment each event fired. Register the plugin once at initialization, before any `track` calls. ```js theme={null} amplitude.add({ name: 'subtext-url', type: 'enrichment', execute: async (event) => { const url = FS('getSession', { format: 'url.now' }) if (url) event.event_properties = { ...event.event_properties, subtext_url: url } return event }, }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-run the user-level linkage on re-identify. Don't use `amplitude.setUserProperties()` — that method belongs to the legacy Amplitude JS SDK; `@amplitude/analytics-browser` v2 requires the `Identify` class above. Don't register the enrichment plugin inside a component render — register it once at the Amplitude initialization point. ## From signal to session Amplitude shows you that a metric moved and who it moved for; the session shows the confusion, error, or broken state behind it. However you first hear about a problem in Amplitude, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. An Amplitude alert fires by email or Slack: "`Onboarding Completed` is anomalously low — 25% below forecast." From the alert, open the chart and segment to users who started but didn't complete in the window. Open a user, go to **User Properties**, and copy `subtext_url`. Grab several, then hand them to your agent: ```text theme={null} Amplitude says Onboarding Completed is 25% below forecast. Here are sessions from users who started onboarding but didn't finish in that window: Review them and find the common stall point. Detect-vs-Diagnose: Amplitude flagged the drop — what does each session actually show at that step? Is it broken, slow, or confusing? Give me one hypothesis and the exact moments backing it. ``` Your scheduled Amplitude dashboard email shows activation down versus last week. Click into the offending chart, drill into the down segment, open the affected users, and copy `subtext_url`. ```text theme={null} This week's Amplitude dashboard shows activation down. Here are sessions from users in the under-performing segment: Walk each one. Where do they fall out of the activation flow, and is it the same place every time? Tell me whether this is a product regression or normal variance, and point to evidence. ``` You build a funnel in Amplitude, see a sharp drop at one step, and click into the users who didn't advance. Open a non-converting user's profile, go to **User Properties**, and copy `subtext_url`. ```text theme={null} I'm drilling into an Amplitude funnel. There's a sharp drop at the step. Here's a user who didn't advance: Open the session and tell me exactly what happened at that step — what they saw, what they clicked, and why they stopped. Is this fixable in the product or is it intent (they just left)? ``` For a drop-off across several users, ask your agent to assemble one proof document (`doc-create`) with a screenshot per user and a single shared link — then paste that back into the Amplitude chart's notes or a Notebook so the metric carries its explanation. If the review shows the drop is intent rather than a defect, record that too — it stops the team from "fixing" a step that isn't broken. ## For agents An autonomous agent can run the whole loop against Amplitude directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Amplitude ships an official MCP server at `https://mcp.amplitude.com/mcp` (EU: `https://mcp.eu.amplitude.com/mcp`) over streaming HTTP, authenticated with OAuth 2.0. The MCP is best for discovery: drive funnel, segmentation, and retention queries in natural language to find the drop steps. Its tool registry is dynamic, so discover tools at runtime via the meta-tools `get_amplitude_context`, `list_tool_categories`, `get_category_tools`, and `describe_tool`, plus `query_chart`. For deterministic work, use the Dashboard REST API instead — base `https://amplitude.com/api/2/...` (US) or `https://analytics.eu.amplitude.com/api/2/...` (EU), HTTP Basic `-u {api_key}:{secret_key}`: ``` GET /api/2/funnels?e={"event_type":"Step 1"}&e={"event_type":"Step 2"}&start=YYYYMMDD&end=YYYYMMDD # the step with the largest count delta is the worst drop-off ``` `GET /api/2/events/segmentation` finds low-converting slices, and the Behavioral Cohorts API (`/api/3/cohorts`) defines or exports at-risk user groups. Read `subtext_url` per user from the User Profile REST API: ``` GET https://profile-api.amplitude.com/v1/userprofile?user_id=&get_amp_props=true # Authorization: Api-Key (literal, not base64) # → response.userData.amp_props.subtext_url ``` EU residency gap: the User Profile API is not available in Amplitude's EU region and there is no EU endpoint. For EU orgs, fall back to the MCP "user properties" capability, a chart or export, or read the link from another store. For each URL, call `review-open(session_url=)` on the Subtext MCP. Event-level URLs are moment-precise, so the review opens exactly when the signal fired. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)) — as a user property, and optionally an event property via the enrichment plugin. For autonomous or headless runs, prefer the API-key Basic-auth REST path over the MCP's OAuth browser flow. Match your region (US vs EU) for the MCP and Dashboard API endpoints; the User Profile API is US-only. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Appcues and Subtext: From a Flow to the Session Source: https://subtext.fullstory.com/docs/integrations/appcues Attach the Subtext session URL to Appcues, then jump from any flow signal — a skipped step, an abandoned onboarding, a losing A/B variant — straight into the user's real session. Appcues tells you *that* an onboarding flow leaked users: a step was skipped, a flow abandoned, a variant underperformed. It can't show you what the user actually saw when that step appeared. Subtext can. Attach the Subtext session URL to the Appcues user profile and every flow signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Appcues detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and the Appcues Web SDK snippet is loaded (`window.Appcues` is available). ## Attach the session URL Store the current Subtext session URL as a profile property via `Appcues.identify`. It lives on the Appcues user profile — usable for flow targeting and retrievable later via the Public API user profile endpoint (`GET /v2/accounts/{account_id}/users/{user_id}/profile`) or the flow analytics Full CSV export, which includes a column for every custom property you send to Appcues. Note that the flow events Appcues forwards to connected analytics tools carry only flow-level attributes (`flowId`, `flowName`, `flowVersion`, `sessionId`) plus the `userId` — not custom profile properties — so use the event's `userId` as the join key, or also send `subtext_url` to your analytics tool directly from your own code if you want it readable there. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl && window.Appcues) { window.Appcues.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl && window.Appcues) { window.Appcues.identify(user.id, { email: user.email, subtext_url: subtextUrl, }) } }, [user]) ``` Call `window.Appcues.page()` on route changes as usual — the identified properties persist across page calls within the session. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Guard on `window.Appcues` being defined so you don't call `identify` before the snippet has loaded. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `Appcues.identify` on re-identify — the property is frozen until the next identify. Finally, don't rely on Appcues alone to read the value back; its profile UI is limited, so retrieve it via the Public API profile endpoint or the Full CSV export (or send it to your analytics tool directly from your own code). ## From signal to session Appcues tells you a flow was skipped or abandoned at a step; it can't show you what the user saw when the flow appeared. However you first hear about it, the path is the same: get to the `subtext_url` — from the user's Appcues profile (Public API or Full CSV export), keyed by the `userId` on the forwarded flow event, or from your analytics tool if your app also attaches the property there — then hand it to your agent for a Detect-vs-Diagnose read. You tweaked an onboarding flow and Appcues analytics now show completion falling at a specific step. Open the Appcues flow event (e.g. `flow_skipped` — it may display as "Flow Skipped" in tools like Amplitude) in your connected analytics tool (Amplitude / Mixpanel / Heap, or via Segment) and note the `userId` on each event — or pull the flow analytics Full CSV export filtered to that step. Then look up each user's `subtext_url` from their Appcues profile (the Full export column or the profile API), or from their person profile in your analytics tool if your app sends the property there directly. Grab several from users who skipped at that step, then hand them to your agent: ```text theme={null} After my last edit to the onboarding flow, completion dropped at the step. Here are sessions from users who skipped there: Review them. When that step appeared, did it render correctly over the right element, or is it mis-anchored / covering something / pointing at an element that isn't there post-edit? Detect-vs- Diagnose: the data says they skipped — what does the session show caused it? One hypothesis + the moments. ``` Your weekly health check — via the Appcues MCP ("How did all my published experiences perform this week compared to last week?") or the Flow Analytics scoreboard — shows a key activation flow underperforming vs. last week. Take the `userId`s from the forwarded flow events in your analytics tool (or the flow analytics Full CSV export) for users who dropped out this week, then look up each user's `subtext_url` from their Appcues profile. ```text theme={null} This week's Appcues health check shows our activation flow underperforming. Here are sessions from users who dropped out of it: Walk each one from when the flow started. Where do they fall out, and is it the same step every time? Tell me whether the flow is broken, badly timed, or just too long, with evidence. ``` Appcues A/B results show one flow variant completing worse than the other. Take the `userId`s for users in the losing variant from the forwarded flow events (or the flow analytics Full CSV export), then look up each user's `subtext_url` from their Appcues profile. ```text theme={null} In our Appcues A/B test, the flow is completing worse. Here are sessions from users who saw it: Open them and tell me what the losing variant experience was actually like — did it render cleanly, was a step confusing, did anything break? I want to know if it's a real design loss or an implementation bug in the variant. ``` For a redesign decision, ask your agent to roll the findings into one proof document (`doc-create`) with the flow step captured as the droppers actually saw it — the evidence for re-anchoring, re-timing, or rewriting it — then link that doc wherever your team tracks flow decisions so the completion number carries its cause. ## For agents An autonomous agent can run the whole loop against Appcues: discover the flow friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Appcues ships an official MCP server at `https://mcp.appcues.com/mcp` (EU: `https://mcp.eu.appcues.com/mcp`), authenticated with your Appcues credentials and honoring account roles. An admin must enable it at `studio.appcues.com/settings/ai-assistant` (see `docs.appcues.com/appcues-mcp-server`). It surfaces flows, experiences, segments, goals, NPS data, events, accounts, and users — but Appcues does not publish an itemized tool-name list, so it's best for *discovering* flow and NPS friction. Reading per-user attributes like `subtext_url` needs an extra admin toggle ("enhanced AI features"); without it, use the Public API for extraction. Use the Appcues MCP to surface flow and NPS hotspots. For per-step drop-off, the Public API (base `https://api.appcues.com/v2/`, with an API key + secret from Studio → Settings → Integrations → API Keys) exposes a flow analytics CSV export with a column per custom property — find the step with the largest drop. Async / bulk-event export is job-based (`job_id` → Get Job Status, or an emailed link that expires in \~a week), and outbound webhooks for flow/checklist events give a real-time friction stream. Read `subtext_url` off the user's complete profile via the Public API: ```text theme={null} GET https://api.appcues.com/v2/accounts/{account_id}/users/{user_id}/profile # "Get a user's complete profile" (EU base: https://api.eu.appcues.com) # → custom profile attribute: subtext_url ``` Alternatively, pull the flow analytics Full CSV export, which includes a `subtext_url` column for affected users. For each URL, call `review-open(session_url=)` on the Subtext MCP, then step through the flow moment to get a Detect-vs-Diagnose read: the data says they skipped — did the step mis-anchor or mis-render, or was it just confusing? `subtext_url` only round-trips if it was attached as a user profile property at capture time (see [Attach the session URL](#attach-the-session-url)). Without the enhanced AI features toggle, the MCP can't read user attributes — use the Public API. Match your region (US vs EU) for the MCP endpoint. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # ClickHouse and Subtext: From a Query to the Session Source: https://subtext.fullstory.com/docs/integrations/clickhouse Keep the Subtext session URL as a queryable column in ClickHouse, then jump from any SQL result — a spiking error event, a dropped cohort — straight into the user's real session. ClickHouse is a columnar analytics database: you query billions of clickstream events with SQL and get back the shape of what happened at scale — a spiking error event, a funnel drop, a cohort that stopped converting. It can't tell you what one of those users actually experienced. Subtext can. Store the Subtext session URL as a column on your events table and every result row deep-links straight into that person's real session — your agent reads the `subtext_url`, opens the session, and walks the decisive moments with screenshots, the component tree, network, and console. ClickHouse detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and that your clickstream events are already flowing into a ClickHouse table carrying a `subtext_url` property. The value is stamped onto events at capture time by whatever collector feeds your warehouse (Snowplow, Hightouch, Segment, or your own inserts). ClickHouse is the store, not the source — it holds the link, it doesn't generate it. ## Attach the session URL The job here is to land `subtext_url` as a first-class column and keep it fast to filter on, so any SQL result row carries a clickable session alongside it. ### Give the link its own column Add a plain `String` column. The value is a long, high-cardinality signed URL, so **never** wrap it in `LowCardinality` — that builds a dictionary the size of your session count and wins nothing. ```sql New table theme={null} CREATE TABLE events ( event_time DateTime, user_id String, event String, subtext_url String DEFAULT '' -- Subtext session link, stamped at capture ) ENGINE = MergeTree ORDER BY (event, event_time); ``` ```sql Existing table theme={null} ALTER TABLE events ADD COLUMN subtext_url String DEFAULT ''; ``` ### When you land raw JSON If you land whole event payloads as a JSON string and shred fields later, pull `subtext_url` into its own column with a `MATERIALIZED` expression so it is computed once at insert and indexes like any other column: ```sql theme={null} ALTER TABLE events ADD COLUMN subtext_url String MATERIALIZED JSONExtractString(properties, 'subtext_url'); ``` Adding the column is instant — no data is rewritten. For rows written before the `ALTER`, ClickHouse computes the expression on the fly at read time from `properties`; run `ALTER TABLE events MATERIALIZE COLUMN subtext_url` to physically write the values into existing parts so reads stop paying the extraction cost. ### Query for sessions Every filter you already run to find interesting behavior now returns a clickable session alongside it: ```sql theme={null} SELECT user_id, subtext_url, event, event_time FROM events WHERE event = 'checkout_error' AND subtext_url != '' ORDER BY event_time DESC LIMIT 20; ``` Don't declare `subtext_url` as `LowCardinality(String)` — it is unique per session, so the dictionary just bloats memory. Don't expose the column to roles or shared views that untrusted users can read: the signed URL grants replay access, so treat it like a credential and keep it in internal, authenticated surfaces. Don't assume historical rows carry it — rows written before the collector started stamping `subtext_url` have no value to store, so backfill from your event archive if you need older sessions. And don't try to generate the URL inside ClickHouse: it originates in the browser via `FS('getSession', { format: 'url.now' })` in your collector — ClickHouse only stores and serves it. ## From signal to session However the query first surfaces a problem — a dashboard tile, an ad-hoc triage, a scheduled model — the path is the same: get from the result row to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. The query says these users errored or dropped; the session shows what they actually hit. An error-event or drop-off tile on a ClickHouse-backed dashboard (Grafana, Metabase, or an internal panel) jumps above trend for a specific event. Pull the offending sessions straight from the events table: ```sql theme={null} SELECT user_id, subtext_url, event_time FROM events WHERE event = 'checkout_error' AND event_time > now() - INTERVAL 1 HOUR AND subtext_url != '' ORDER BY event_time DESC LIMIT 20; ``` Grab a few links, then hand them to your agent: ```text theme={null} Our ClickHouse dashboard shows a spike in `checkout_error` in the last hour. Here are session URLs for users who hit it: Review them and find the common failure point. Detect-vs-Diagnose: the data says they errored — what does each session actually show at that moment? One synthesized hypothesis at the end. ``` A customer says "the page just froze," and you want to see everyone who reached the same state. Filter to the affected users and grab the links: ```sql theme={null} SELECT user_id, subtext_url, event, event_time FROM events WHERE user_id IN () AND subtext_url != '' ORDER BY event_time DESC LIMIT 50; ``` ```text theme={null} A user reported the app froze on this flow. Here's a session where it happened: Open it and tell me what the UI, console, and network were doing at the freeze. Was it a bug, a slow request, or expected behavior? ``` A cohort converts or retains below trend in your weekly model, and you want the human story before you write it up. Join the cohort back to the events table for their session links: ```sql theme={null} SELECT user_id, any(subtext_url) AS subtext_url FROM events WHERE user_id IN () AND subtext_url != '' GROUP BY user_id LIMIT 20; ``` ```text theme={null} This cohort dropped out of the activation funnel. Here are their sessions: Review them and tell me whether the drop was a deliberate choice or something broke/confused them. Consolidate into one hypothesis I can put in the retention readout. ``` For a cohort investigation, ask your agent to roll the findings into one proof document (`doc-create`) — a screenshot per user and one shareable link — then drop the summary into the dashboard annotation or the ticket so the next person sees the human story behind the number. If the "drop" turns out to be a deliberate user choice with no bug, say so — that redirects effort away from engineering. ## For agents An autonomous agent can run the whole loop against ClickHouse directly: discover the friction with SQL, extract the `subtext_url` from the same rows, and hand each session to the Subtext MCP. Unlike most tools, ClickHouse ships a first-party data MCP — **`mcp-clickhouse`** (`ClickHouse/mcp-clickhouse`, on PyPI). It connects to your cluster with `CLICKHOUSE_HOST` / `CLICKHOUSE_USER` / `CLICKHOUSE_PASSWORD` and is **read-only by default** (`CLICKHOUSE_ALLOW_WRITE_ACCESS=false`), which is exactly what a review agent wants: it can select session links but cannot mutate data. `list_databases` and `list_tables` enumerate the cluster and find the events table (paginated, with `like` / `not_like` filters). Then `run_query` aggregates to find the worst hotspot: ```sql theme={null} -- step-to-step counts to find the worst drop SELECT event, count(DISTINCT user_id) AS users FROM events WHERE event_time > now() - INTERVAL 7 DAY GROUP BY event ORDER BY users DESC; ``` `run_query` does discover and extract at once — the filter that finds the behavior also returns the link: ```sql theme={null} -- worst recent error events, with a session per user SELECT user_id, subtext_url, event, event_time FROM events WHERE event = 'checkout_error' AND event_time > now() - INTERVAL 24 HOUR AND subtext_url != '' ORDER BY event_time DESC LIMIT 25; ``` For each URL, call `review-open(session_url=)` on the Subtext MCP and step through the session for a Detect-vs-Diagnose read: the query says they errored; the session shows what they actually hit. `subtext_url` only round-trips if the collector attached it at capture time — rows written before the collector started stamping `subtext_url` carry an empty string, so always filter `subtext_url != ''`. Keep `run_query` in read-only mode; a review agent never needs write access. And because it is a high-cardinality column, always `LIMIT` and order your queries — don't pull every session. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Datadog and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/datadog Attach the Subtext session URL to Datadog RUM, then jump from any Datadog signal — a tripped monitor, a RUM error, an incident dashboard — straight into the user's real session. Datadog tells you *that* something crossed a line: a monitor tripped, a RUM error rate spiked, failed requests climbed on a dashboard. It can't tell you *why* one specific person was blocked. Subtext can. Attach the Subtext session URL to your Datadog RUM data and every Datadog signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Datadog detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the Datadog Browser RUM SDK (`@datadog/browser-rum`) is initialized. ## Attach the session URL Store the current Subtext session URL on your Datadog RUM data so it travels with the signal. There are three places to attach it, depending on how precise the link needs to be. ### On the user context Attach the URL to the RUM user context via `setUser`. It then rides along on every subsequent view, action, error, and resource event as `@usr.subtext_url`. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { datadogRum.setUser({ id: user.id, subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { datadogRum.setUser({ id: user.id, email: user.email, subtext_url: subtextUrl }) } }, [user]) ``` ### On global context If you prefer not to overload the user object, set it as global context instead. It lands on events as `@context.subtext_url`. ```js theme={null} datadogRum.setGlobalContextProperty('subtext_url', subtextUrl) ``` ### On a specific action When the exact moment matters, attach the URL to a single custom action. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal moments like errors, rage clicks, and conversion failures. ```js theme={null} datadogRum.addAction('checkout_failed', { reason: error.message, subtext_url: FS('getSession', { format: 'url.now' }), }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The Subtext session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `setUser` (or `setGlobalContextProperty`) whenever you re-identify the user; the value is frozen at set-time and does not update automatically. `setUser` replaces the whole user object while `setUserProperty` merges — pick one and stay consistent. And don't stash the URL only in `addError` extra context; set it on the user or global context so it's searchable across every RUM event type. ## From signal to session However you first hear about a problem in Datadog, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Datadog tells you a metric crossed a threshold or an error fired; the session tells you whether a real person was actually blocked, what they saw, and the precise sequence behind it. A Datadog monitor trips and PagerDuty pages the on-call engineer: "Browser RUM error rate > 5% on `/checkout` for 5 min." Open the monitor from the page and jump to the correlated RUM events. Open a representative error event, go to **Attributes**, and copy `usr.subtext_url`. ```text theme={null} A Datadog monitor paged me: Browser RUM error rate spiking on /checkout. Here's a session from an affected user: It's 2am — I need signal fast. Open the session, give me a Detect-vs-Diagnose read. Is this a real user-facing outage or noisy telemetry? What broke, what did the user see, and is it isolated or systemic? One paragraph, plus the single most important screenshot. ``` Datadog posts to your alerts channel: "RUM error: `Uncaught TypeError` — 60 sessions in the last hour." Click into the RUM Explorer from the alert, filter to the error, open a few events, and copy `usr.subtext_url` from several of them. ```text theme={null} Datadog flagged a recurring RUM error across ~60 sessions. Here are subtext_urls from a sample: Review them together. What's the common trigger — same component, same API failure, same device? Which sessions show the user actually stuck vs. recovered? Give me one root-cause hypothesis and a go/no-go on whether this needs a hotfix tonight. ``` During or after an incident, a Datadog dashboard shows a clear anomaly window: a spike in failed requests correlated with a drop in conversions. In the RUM Explorer, scope to the incident window, filter `@usr.subtext_url:*`, and open a session that sits inside the spike. Copy `usr.subtext_url`. ```text theme={null} We had an incident between and . This Datadog dashboard shows failed requests spiking against a conversion drop. Here's a user session from inside that window: Open it and tell me the human story behind the graph — what did this user try to do, where did it fail, and what did the failure look like on screen? I'm writing the postmortem; I need the customer-impact narrative, not just the metrics. ``` For a postmortem, ask your agent to assemble a proof document (`doc-create`) with the key screenshots and the session link — one URL that shows what users actually hit — then drop it into the incident channel so the metrics graph gets a human-impact caption. And if the session proves the alert was noise (error fired, user unaffected), feed that Detect-vs-Diagnose "no real impact" verdict back into the monitor's tuning. ## For agents An autonomous agent can run the whole loop against Datadog directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Datadog ships a first-party MCP server (GA March 2026). The hosted endpoint is site-parametrized (US1 form `https://mcp.datadoghq.com/api/unstable/mcp-server/mcp` — check your site's setup docs for the current stable URL), with local stdio via the `datadog_mcp_cli` binary. Auth is OAuth 2.0, with `DD_API_KEY` + `DD_APPLICATION_KEY` headers (or a bearer token in the `Authorization` header) as a fallback. Docs: `docs.datadoghq.com/mcp_server/`. Repo: `github.com/datadog-labs/mcp-server`. `search_datadog_rum_events` is the core discovery tool — filter on the frustration facet `@action.frustration.type` (values `rage_click`, `dead_click`, `error_click`) to surface hotspots, or `@session.frustration.count:>1` for session-level friction. For grouped errors, use `search_datadog_error_tracking_issues` and `get_datadog_error_tracking_issue`; `ddsql_run_query` runs SQL over the `dd.rum` table function (pick the event subtype via its `event_type` parameter), and `get_rum_summary` / `get_rum_insight` return summarized hotspots. Without the MCP, the same over REST: ``` POST /api/v2/rum/events/search # raw events, filter.query "@type:error" POST /api/v2/rum/analytics/aggregate # group_by @action.frustration.type for counts POST /api/v2/error-tracking/issues/search # grouped errors # DD-API-KEY / DD-APPLICATION-KEY headers ``` Filter the same RUM search on `@usr.subtext_url:*` to pull the replay links — `search_datadog_rum_events` does both jobs. Over REST: ``` POST /api/v2/rum/events/search # body: { "filter": { "query": "@usr.subtext_url:*" } } # response path: data[N].attributes.attributes["usr.subtext_url"] ``` If you set the URL as global context instead of on the user, it lands as `@context.subtext_url`. For each URL, call `review-open(session_url=)` on the Subtext MCP. Action-level URLs are moment-precise, so the review opens exactly when the signal fired. For an incident, scope the RUM search to the incident window first, then review a session from inside the spike. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)); the value is frozen at set-time and doesn't auto-update. Action-level links are moment-precise; user- and global-context links open at the moment the user was identified. Check a live response for the exact nesting of `usr.subtext_url` under `data[N].attributes.attributes`. Match your Datadog site (US1/US3/US5/EU/AP1/AP2/UK1) for both the MCP endpoint and the API host. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # GrowthBook and Subtext: From an Experiment Result to the Session Source: https://subtext.fullstory.com/docs/integrations/growthbook Attach the Subtext session URL to your GrowthBook exposures, then jump from a variation that moved a metric straight into the real session of a user who saw it. GrowthBook tells you *that* a variation moved a metric: a feature flag rolled out, an experiment reached significance, a variation lost on conversion. It can't show you *what* a user in that variation actually experienced. Subtext can. GrowthBook is warehouse-native, so it routes every experiment exposure through your `trackingCallback` — attach the Subtext session URL there and each exposure carries a link back to the real session. Your agent reads the `subtext_url`, opens that person's session, and walks the variation experience with screenshots, the component tree, network, and console. GrowthBook detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and that the GrowthBook SDK (`@growthbook/growthbook`) is initialized with a `trackingCallback`. ## Attach the session URL GrowthBook doesn't store user data itself — attributes are evaluated locally, and only your `trackingCallback` persists exposures. So attach the URL in two places: on the attributes (so it's available to evaluate against) and through the tracking callback (so it lands in your exposure stream). ### On the GrowthBook attributes Attach the URL to the GrowthBook attributes with `setAttributes`. Spread the existing attributes first so you don't wipe targeting fields. In React, put it in the same `useEffect` as `FS('setIdentity')`. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { gb.setAttributes({ ...gb.getAttributes(), subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { gb.setAttributes({ ...gb.getAttributes(), id: user.id, subtext_url: subtextUrl }) } }, [user]) ``` ### Through the tracking callback GrowthBook routes experiment exposures through `trackingCallback`. Read the attribute there so the URL lands in your warehouse exposure table alongside the experiment and variation. ```js theme={null} const gb = new GrowthBook({ trackingCallback: (experiment, result) => { analytics.track('experiment_viewed', { experimentId: experiment.key, variationId: result.key, subtext_url: gb.getAttributes().subtext_url, }) }, }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't pass a bare object to `setAttributes` — it replaces all attributes, so spread `gb.getAttributes()` first. And don't expect the URL to appear anywhere without a `trackingCallback` — GrowthBook evaluates locally and only your callback persists exposures. The URL changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `setAttributes` whenever you re-identify the user; attributes are frozen until the next call. ## From signal to session However you first hear that a variation moved — a significance alert, a results review, a health warning — the path is the same: get to the `subtext_url` for a few exposed users, then hand them to your agent for a Detect-vs-Diagnose read. The result says the variation regressed; the session shows whether it rendered correctly, errored, or simply behaved in a way users disliked. GrowthBook posts to Slack: *"Experiment `pricing-table-v2` reached significance — variation B is down on `signup_rate`."* Pull the regressed users' exposures from where your tracking callback writes them: ```sql theme={null} SELECT user_id, experiment_id, variation_id, subtext_url, timestamp FROM experiment_viewed WHERE experiment_id = 'pricing-table-v2' AND variation_id = 'B' AND subtext_url IS NOT NULL ORDER BY timestamp DESC LIMIT 20; ``` Copy a few `subtext_url` values, then hand them to your agent: ```text theme={null} GrowthBook says variation B of pricing-table-v2 reached significance and lost on signup_rate. Here are sessions from users who were exposed to variation B: Detect-vs-Diagnose: the result says B is worse — what does B actually look like for these users? Did the variation render correctly, throw an error, or just read differently? One root-cause hypothesis and a ship / iterate / kill recommendation. ``` In the experiment review, a variation's lift is negative and the room wants to know whether it's the design or a bug. From the `experiment_viewed` event in your analytics tool (PostHog / Amplitude / Mixpanel), open the **Properties** tab and copy `subtext_url` for a few users in the losing variation. ```text theme={null} We're reviewing . Variation has negative lift. Here's a session from a user who saw it: Open it and tell me what the variation experience was actually like. Is the lift loss explained by a rendering bug / error, or did the design just underperform? I need a concrete cause for the review, not speculation. ``` GrowthBook flags a sample-ratio mismatch or a suspicious metric anomaly, hinting the variation is broken for some users. Pull a sample of affected-variation exposures from the warehouse and copy `subtext_url`. ```text theme={null} GrowthBook flagged a health issue (SRM / anomaly) on . Here are sessions from the affected variation: Look for something breaking that would skew exposure or metrics — JS errors, a variation failing to render, users bouncing instantly. Tell me whether the experiment data is trustworthy or contaminated, with evidence. ``` A "variation is broken" verdict invalidates the result — re-run after fixing — while a "design underperformed" verdict is a real finding. For a regression across several users, ask your agent to assemble one proof document (`doc-create`) with a screenshot per exposed user, then paste that single link into the GrowthBook experiment notes so the lift number carries its cause. ## For agents An autonomous agent can run the whole loop against GrowthBook directly: discover the regressed variation, extract the `subtext_url`, and hand each session to the Subtext MCP. GrowthBook ships an official MCP server — `@growthbook/mcp`, open source at `github.com/growthbook/growthbook-mcp` — but it runs locally over stdio (`npx -y @growthbook/mcp@latest`); there is no hosted or remote endpoint. Authenticate with env vars (`GB_API_KEY` is an API key or PAT; `GB_EMAIL` is required for flag and experiment tools). Docs live at `docs.growthbook.io/integrations/mcp`. Call `get_experiments` with response mode `full` (metadata + results) or `summary` (results + metrics) to surface the regressed variation and metric directly. Without the MCP, hit the REST API — base `https://api.growthbook.io/api` (Cloud) or `https://{domain}/api` (self-host), auth `Authorization: Bearer `: ``` GET /v1/experiments/{id}/results # getExperimentResults → aggregated per-variation/metric stats ``` Confirm field names against the OpenAPI spec at `https://api.growthbook.io/api/v1/openapi.yaml`. The REST API and `get_experiments` return **aggregated results only** — no raw per-user exposure rows. GrowthBook is warehouse-native, so `subtext_url` lives on the `experiment_viewed` exposure table the `trackingCallback` writes: ```sql theme={null} SELECT user_id, variation_id, subtext_url FROM experiment_viewed WHERE experiment_id = '' AND variation_id = '' AND subtext_url IS NOT NULL ORDER BY timestamp DESC LIMIT 100; ``` With your own warehouse, the shape of `experiment_viewed` is whatever your `trackingCallback` pipeline writes — no GrowthBook setting changes it, so emit `subtext_url` as its own event property (as above) rather than nesting it. (If you instead use GrowthBook Cloud's Managed Warehouse — where events are ingested via GrowthBook's SDK tracking plugin, not your own `analytics.track` — you can register `subtext_url` as a **Key Attribute** on the data-source settings page to lift it into a top-level column; this applies to new events only.) Note that the MCP's `get_attributes` returns the attribute *schema*, not a user's stored values — it is **not** the path to a per-user `subtext_url`. For each URL, call `review-open(session_url=)` on the Subtext MCP, then step through the key moment in the variation for a Detect-vs-Diagnose read: the variation regressed versus did it actually break, or just underperform. `subtext_url` only round-trips if the `trackingCallback` wrote it into the exposure stream at capture time (see [Attach the session URL](#attach-the-session-url)). No REST endpoint exposes raw exposures or per-user attribute values — per-user reads are warehouse-only. If you forward exposures to an event tracker (Segment / Amplitude / Mixpanel), you can read `subtext_url` off the `experiment_viewed` event there instead. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Hightouch and Subtext: From a Cohort to the Session Source: https://subtext.fullstory.com/docs/integrations/hightouch Attach the Subtext session URL to Hightouch Events, then jump from any warehouse cohort — a campaign, a computed audience, a bad-event sync — straight into the user's real session. Hightouch is a Composable CDP: it pipes events into your warehouse and activates audiences out into ad platforms, email, and CRMs. It tells you *who* a person is and *which* segment they fell into — not *what they experienced*. Subtext can. Attach the Subtext session URL to your Hightouch Events data and every cohort carries a jump-to-session link — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Your warehouse cohorts detect; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing, and the Hightouch Events browser SDK is loaded — the `window.htevents` snippet or the npm `@ht-sdks/events-sdk-js-browser` package. ## Attach the session URL Store the current Subtext session URL on your Hightouch Events data so it travels into the warehouse as a column, ready to filter audiences and dashboards on. The Events browser SDK is modeled on the Segment `analytics.js` spec, so there are two places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the user with `htevents.identify`. It lands as a trait and, downstream, a column on the `identifies` table in your warehouse. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { htevents.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { htevents.identify(user.id, { subtext_url: subtextUrl }) } }, [user]) ``` ### On every event Source middleware runs on every call, so it attaches the URL fresh per event. Because `url.now` carries a timestamp, the link deep-links to the moment each event fired. Event properties auto-convert into warehouse columns, so `subtext_url` becomes a column on the `track` and `page` event tables. ```js theme={null} htevents.addSourceMiddleware(({ payload, next }) => { // Stamp both track and page events. Page views land in their own warehouse // table, so landing-page queries can filter on `subtext_url` too. if (payload.obj.type === 'track' || payload.obj.type === 'page') { const url = FS('getSession', { format: 'url.now' }) if (url) payload.obj.properties = { ...payload.obj.properties, subtext_url: url } } next(payload) }) ``` Register the middleware once at initialization, before any `track` calls — not inside a component render. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The URL changes on a new session and when the user re-identifies, so call `htevents.identify` on every auth state change to keep the profile trait current; the source middleware reads the URL fresh per event and never needs re-attaching. Pick `subtext_url` and use the same key across `identify` and `track` — warehouse columns and audience filters are case-sensitive. The signed URL grants replay access, so keep it in your warehouse and internal surfaces; never sync it into a third-party ad or email audience. ## From signal to session However the cohort first surfaces — a campaign report, a computed audience, a sync check — the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Hightouch Events stores the value as `subtext_url` on the profile and event tables in your warehouse. The growth marketer is watching a landing-page campaign. It drives clicks, but the landing page converts below plan. Hightouch captured the UTM parameters on the events (`context.campaign`), so the cohort is addressable. Query the events table for that campaign's sessions: ```sql theme={null} SELECT user_id, subtext_url, timestamp FROM hightouch_events.pages WHERE context_campaign_name = 'summer_launch' AND subtext_url != '' ORDER BY timestamp DESC LIMIT 20; ``` Grab a few links, then hand them to your agent: ```text theme={null} Our `summer_launch` paid campaign converts well below plan on the landing page. Here are sessions for users who arrived from it but didn't convert: Review them and find the common drop-off. Detect-vs-Diagnose: the data says they bounced — what does each session actually show on the landing page? One synthesized hypothesis at the end. ``` The lifecycle / CRM owner sees a user land in a computed audience like *"started checkout, no purchase in 24h,"* and wants to know *why* before sending a win-back. Open the user's warehouse profile, or query their most recent session link, and copy `subtext_url`. ```text theme={null} This user entered our "abandoned checkout" audience. Before I send a win-back, I want to know what actually happened. Session: Open it and tell me: did they abandon by choice, or did something break/confuse them at checkout? If it's a bug, that changes the message I send. Walk me through the relevant moments. ``` The marketing-ops or data engineer who owns the Hightouch source sees a sync surface malformed or missing properties on a key event, hinting at a broken client. Find a recent offending event that still carries `subtext_url` and copy it. ```text theme={null} Our Hightouch source shows malformed `Checkout Started` events from the web client. Here's a session where one fired: Open it around that event. Is the client genuinely broken (bad state, JS error) or is the tracking just mis-wired? Show me the UI and console at that moment. ``` For a campaign investigation across several users, ask your agent to consolidate the findings into one proof document (`doc-create`) — a screenshot per user and one shareable link — then drop it into the campaign retro or audience note so the next person sees the human story behind the segment. ## For agents An autonomous agent can run the whole loop: discover the cohort, extract the `subtext_url`, and hand each session to the Subtext MCP. Hightouch does ship an [official MCP server](https://hightouch.com/docs/ai-integrations/mcp) — it connects your assistant to Hightouch's marketing agents for exploring your schema, building and saving audiences, and designing journeys — but it is **not documented as an event-history reader**, and it isn't enabled in every workspace. The events land in your warehouse, so the agent story runs through the warehouse's MCP. If that warehouse is ClickHouse, use the official `mcp-clickhouse` server (`list_databases`, `list_tables`, `run_query`, read-only by default). For Snowflake / BigQuery / Redshift, use that warehouse's own MCP or SQL API — the query shape is the same. Hightouch's REST API manages models and syncs, not event history, so it is the wrong surface for pulling session links. Find the campaign, audience, or failing-event cohort worth watching. Because Hightouch captures UTM parameters, you can scope directly to a campaign. To triage a computed audience instead, join the audience membership table to the events table and pull each member's most recent `subtext_url`. Read `subtext_url` off those rows with the warehouse's read query tool: ```sql theme={null} -- non-converting sessions from a specific paid campaign SELECT user_id, subtext_url, timestamp FROM hightouch_events.pages WHERE context_campaign_name = 'summer_launch' AND timestamp > now() - INTERVAL 7 DAY AND subtext_url != '' ORDER BY timestamp DESC LIMIT 25; ``` For each URL, call `review-open(session_url=)` on the Subtext MCP. Event-level URLs are moment-precise, so the review opens exactly when the signal fired. `subtext_url` only round-trips if the Events SDK attached it at capture (see [Attach the session URL](#attach-the-session-url)); older rows carry an empty value, so filter `subtext_url != ''`. Table and column names depend on how your Hightouch source maps events into the warehouse — confirm them before hard-coding. Keep the warehouse MCP read-only; a review agent never needs write access. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Intercom and Subtext: From a Conversation to the Session Source: https://subtext.fullstory.com/docs/integrations/intercom Attach the Subtext session URL to your Intercom contacts, then jump from any support conversation — a ticket, an escalation, a bad CSAT — straight into the user's real session. A support conversation is the user's *description* of what went wrong — secondhand, often vague ("the button doesn't work"). Intercom tells you *that* someone is stuck. It can't show you *what actually happened* on their screen. Subtext can. Attach the Subtext session URL to the Intercom contact and every conversation becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Intercom detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing, and the Intercom Messenger is installed — either via the JavaScript snippet or the `@intercom/messenger-js-sdk` npm package. Each code tab below is written for one install method. It also assumes a custom data attribute named `subtext_url` exists in **Intercom → Settings → Data → People** — custom attributes must be created before the Messenger can write them. ## Attach the session URL Store the current Subtext session URL on the Intercom contact as the `subtext_url` custom attribute so it travels with the conversation and shows in the inbox sidebar. Attach it through the `update` call — or pass it at boot with the modern SDK. ```js analytics.js theme={null} // JavaScript snippet install const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { window.Intercom('update', { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} // npm SDK install import { update } from '@intercom/messenger-js-sdk' useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { update({ subtext_url: subtextUrl }) } }, [user]) ``` ```js boot.js theme={null} // npm SDK install import Intercom from '@intercom/messenger-js-sdk' const settings = { app_id: '', user_id: user.id } const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) settings.subtext_url = subtextUrl // getSession usually returns null this early — the update-on-identify // path above is the reliable way to attach. Intercom(settings) ``` The session URL changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `update(…)` (or `window.Intercom('update', …)` for snippet installs) whenever you re-identify the user — the attribute is frozen until the next update. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't skip creating the `subtext_url` custom attribute in Intercom settings first — undeclared attributes are silently dropped. And don't spam the update call: Intercom throttles the Messenger to 20 `update` calls per 30 minutes, so attach on identify, not on every render. ## From signal to session However you first hear about a problem in Intercom, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. The ticket says X is broken; the session shows whether it reproduces, what the user really clicked, and where it failed — so you can answer (or escalate) from evidence instead of guessing. A conversation is assigned to you: *"I clicked Pay and nothing happened. Tried three times."* Open the conversation, go to the **contact details sidebar**, find `subtext_url` under custom attributes, and copy it. Then hand it to your agent: ```text theme={null} A user opened a support ticket: "I clicked Pay and nothing happened, tried 3 times." Here's their session: Open it, find the moment(s) they clicked Pay, and tell me what actually happened. Did the button respond? Was there an error or a failing request? Does it reproduce? Give me a plain-language explanation I can reply with, plus whether this needs to go to engineering. ``` You've decided a ticket is a real bug and are about to open a Linear / Jira issue for the product team. Copy `subtext_url` from the contact sidebar so it travels into the engineering ticket alongside your summary. ```text theme={null} I'm escalating this support ticket to engineering and want a tight bug report. User session: Produce a reproduction-grade write-up: the exact steps the user took, the UI state at failure, the relevant console/network errors, and a clear repro sequence. Format it so I can paste it straight into a Linear issue — engineers should be able to act without re-interviewing the user. ``` Several conversations come in within an hour all describing the same thing — *"export is failing."* Open each conversation and copy `subtext_url` from each contact sidebar, then review them together. ```text theme={null} We're getting a wave of "export is failing" tickets. Here are sessions from several of the users who reported it: Review them together. Is it the same failure for everyone, or different problems that sound alike? Find the common trigger and tell me whether this is one bug, a regional/browser issue, or user error. I need to know if I should post a status banner. ``` A conversation gets a low CSAT rating and a comment like *"never actually got it working."* Open the rated conversation, go to the contact sidebar, and copy `subtext_url`. ```text theme={null} This conversation got a bad CSAT and the user said they never got it working. Session: Open it and tell me what the user was actually up against — was this a product bug we couldn't have solved in chat, or a support miss? I want to know whether to fix the product or coach the team. ``` Paste the agent's summary as an internal note on the conversation so the next rep inherits the diagnosis. When escalating, attach the agent's repro write-up (or a **proof document** via `doc-create`) to the engineering ticket — the `subtext_url` plus screenshots means engineers don't have to re-interview the customer. ## For agents An autonomous agent can run the whole loop against Intercom directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Intercom ships an official MCP server at `https://mcp.intercom.com/mcp` (Streamable HTTP; legacy SSE at `/sse`), authenticated with OAuth or a Bearer access token. The Intercom MCP server supports **US-hosted workspaces only** — EU and AU data regions are not supported yet. If your workspace is EU/AU, use the REST API instead. Surface the worst conversations — low CSAT, `bug` / `confusion` tags, topic spikes. Over MCP, `search_conversations` filters by source, author, state, assignment, and timing; `search` runs a universal query across conversations and contacts. Over REST: ``` POST https://api.intercom.io/conversations/search # Authorization: Bearer # filter by: tag_ids (IN), conversation_rating.score (CSAT), state, created_at / updated_at timing # nested AND/OR (max 2 nesting levels, 15 filters/group) ``` Narrow to the affected users with `POST /contacts/search`. Read `subtext_url` off the contact's custom attributes. Over MCP, `get_contact` returns complete contact info including custom attributes (`search_contacts` can also filter by them). Over REST: ``` GET https://api.intercom.io/contacts/{contact_id} # Authorization: Bearer # → response.custom_attributes.subtext_url ``` For each URL, call `review-open(session_url=)` on the Subtext MCP to get a Detect-vs-Diagnose read: the ticket says X broke versus whether it reproduces in the session. For escalation, ask the review to produce reproduction-grade steps (and optionally a `doc-create` proof document) so the bug report carries evidence, not a paraphrase. `subtext_url` only round-trips if it was stored as a contact custom attribute at capture time (see [Attach the session URL](#attach-the-session-url)). The Intercom MCP is US-region-only today — fall back to the REST API for EU/AU workspaces. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # LangSmith and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/langsmith Attach the Subtext session URL to LangSmith trace metadata, then jump from any flagged run — an error, a low eval score, a thumbs-down — straight into the user's real session. LangSmith tells you *that* a run misbehaved: it errored, scored low on an eval, or a human thumbs-downed it. It can't tell you whether the person on the other end was actually blocked, confused, or fine. Subtext can. Attach the Subtext session URL to your LangSmith trace metadata and every flagged run becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. LangSmith detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the `langsmith` SDK is installed with tracing enabled (`LANGSMITH_TRACING=true`, `LANGSMITH_API_KEY` set), or that you run on LangSmith Deployment (formerly LangGraph Platform). ## Attach the session URL LangSmith is the exception to Subtext's flat-property convention. Most integrations attach `subtext_url` as a top-level property on a user, session, or event record. A LangSmith run has no such column — its context lives in **metadata**, a dict attached at run-create time. Attach `subtext_url` there, nested under `metadata`, on the **root run** (the top of the trace) so anything reading the trace's metadata sees it without walking every child run. Which surface you use depends on how your agent runs. The URL itself originates in the browser. Capture it with `FS('getSession', { format: 'url.now' })` — it returns `null` until the session has started, so read it after init (and re-read after a re-identify), then send it to your backend with the request that starts the agent run: ```js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) // include subtextUrl in the request body that kicks off the agent run ``` ### `@traceable` (Python decorator) A static `metadata=` on the decorator is fixed at import time, which is no use for a per-end-user URL. Pass it per call instead, via `langsmith_extra`: ```python theme={null} from langsmith import traceable @traceable def run_agent(user_input: str): ... def handle_request(user_input: str, subtext_url: str | None): return run_agent( user_input, langsmith_extra={"metadata": {"subtext_url": subtext_url}} if subtext_url else {}, ) ``` ### `RunTree` (manual instrumentation) ```python theme={null} from langsmith.run_trees import RunTree run = RunTree( name="agent_run", run_type="chain", inputs={"input": user_input}, extra={"metadata": {"subtext_url": subtext_url}}, ) ``` ### `config.metadata` (LangChain / LangGraph runnables) The common case: your agent is a LangChain or LangGraph runnable invoked once per end-user request. Thread the session URL through the invoke `config` — the active `LangChainTracer` reads `config["metadata"]` and writes it onto the run automatically, no direct tracer call needed. ```python Python theme={null} result = agent.invoke( {"messages": [...]}, config={"metadata": {"subtext_url": subtext_url}}, ) ``` ```ts TypeScript theme={null} const result = await agent.invoke({ messages: [...] }, { metadata: { subtext_url: subtextUrl } }) ``` ### LangSmith Deployment (deployed assistants) If your agent runs as a LangSmith Deployment, attach the same key in the run-create call's top-level `metadata` field, whether from the SDK or REST directly. This is the surface a backend or proxy uses when it — not the browser — holds both the end-user's session identity and the call that starts the agent run. ```python Python SDK theme={null} from langgraph_sdk import get_client client = get_client(url=DEPLOYMENT_URL) run = await client.runs.create( thread_id, assistant_id, input={"messages": [...]}, metadata={"subtext_url": subtext_url}, ) ``` ```http REST theme={null} POST /threads/{thread_id}/runs { "assistant_id": "agent", "input": { "messages": [...] }, "metadata": { "subtext_url": "" } } ``` Don't expect `subtext_url` to appear as a filterable top-level column — it's nested under `metadata`, so a query needs FQL like `eq(metadata_key, "subtext_url")`, not a bare property filter. Don't attach it only on a child run: a person reading the root-run metadata panel, or an agent fetching the trace by id, won't see it there. And don't store a raw session id where the URL belongs — attach the clickable viewer URL, since that is what gets opened directly. The value written at run-create is frozen, so if the same end-user drives a multi-turn thread, re-attach the current `subtext_url` on each new run — in the invoke `config["metadata"]` for runnables, or the run-create `metadata` field on LangSmith Deployment. ## From signal to session However you first hear about a bad run in LangSmith — a flagged trace, an eval regression, an error spike — the path is the same: get to the `subtext_url` in the run's metadata, then hand it to your agent for a Detect-vs-Diagnose read. If you land on a child run and don't see it, jump to the root run, where it's attached. Scanning the traces table (or an annotation queue) in your LangSmith project, you spot a run someone tagged low-quality, or thumbs-downed from your product's feedback widget. Open the run, go to the **Metadata** panel, and copy the `subtext_url` value. If you're on a child run and don't see it, jump to the root run. ```text theme={null} This LangSmith run got flagged low-quality (thumbs-down from the end-user). Here's their session: Open it and give me a Detect-vs-Diagnose read. Did the agent actually produce a bad outcome, or did the person hit something else — a slow page, a confusing next step, an unrelated bug? Point to the exact moment they reacted, and tell me whether this is an agent-quality issue or a product-friction issue. ``` An online evaluator's score (say `answer_correctness`, or your own `review_quality` feedback key) drops week-over-week on the LangSmith experiments dashboard. Filter the project's runs by the low-scoring feedback key, open a handful of the worst-scoring runs, and copy `subtext_url` off each one's metadata. ```text theme={null} Our eval score for dropped this week. Here are sessions from the lowest-scoring runs: Review them and find the common thread. Is the eval catching a real regression in what the agent produced, or are these sessions where the person's own input was already unusual? Give me one synthesized hypothesis for the drop. ``` A spike in errored runs on a specific chain or node — LangSmith's own monitoring, or an Automation-driven Slack/webhook alert, flags it. Filter runs by `error` for the affected chain in the window, open a few, and copy `subtext_url` off each. ```text theme={null} Errors spiked on in the last 15 minutes. Here are sessions from a few of the errored runs: Walk each session up to the point the error would have surfaced. Did the person actually see a broken experience, or did the agent recover or retry silently? Tell me if this needs a rollback or if it's contained. ``` For a spike or regression across several runs, ask your agent to roll the findings into one proof document (`doc-create`) with a screenshot per session and a single shared link — then paste the synthesis back onto the run as a LangSmith comment or annotation, so the score or error carries a human explanation, not just a number. ## For agents An autonomous agent can run the whole loop against LangSmith directly: discover the flagged runs, extract the `subtext_url` from trace metadata, and hand each session to the Subtext MCP. LangChain ships an official MCP server, `langsmith-mcp-server` — run it locally over stdio (`pip install langsmith-mcp-server` or `uvx langsmith-mcp-server`) or in Docker, authenticated with `LANGSMITH_API_KEY`. Repo: `github.com/langchain-ai/langsmith-mcp-server`; docs: `docs.langchain.com/langsmith/langsmith-mcp-server`. With the MCP, `fetch_runs` is the discovery tool — fetch a trace tree by `trace_id`, filtering by error, `run_type`, or a raw FQL (Filter Query Language) query. Without the MCP, `Client.list_runs` takes the same FQL `filter`: ```python theme={null} from langsmith import Client client = Client() # errored runs errored = client.list_runs(project_name="your-project", filter='eq(status, "error")') # thumbs-down / low score on a feedback key you log (e.g. user_score, review_quality) low_score = client.list_runs( project_name="your-project", filter='and(eq(feedback_key, "user_score"), lt(feedback_score, 1))', ) ``` See the [trace query syntax reference](https://docs.langchain.com/langsmith/trace-query-syntax) for the full filter grammar. Read `subtext_url` off the flagged run's root-run metadata. A run fetched from deep in the trace tree may not carry it, so walk up to the root run (no `parent_run_id`) if the child run you matched doesn't have it: ```python theme={null} for run in errored: metadata = run.extra.get("metadata", {}) subtext_url = metadata.get("subtext_url") if subtext_url: ... # hand off below ``` For each URL, call `review-open(session_url=)` on the Subtext MCP, then step through at the flagged moment for a Detect-vs-Diagnose read. Batch several runs' URLs to review a spike or regression together for the common cause. `subtext_url` only round-trips if it was attached to the root run at trace-create time (see [Attach the session URL](#attach-the-session-url)). It's metadata, not a top-level column, so discover by error, score, or feedback first, then read `subtext_url` off the result. Treat a missing value as "not instrumented," not an error. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # LaunchDarkly and Subtext: From a Flag to the Session Source: https://subtext.fullstory.com/docs/integrations/launchdarkly Attach the Subtext session URL to the LaunchDarkly context, then jump from any flag signal — a guarded-rollout regression, a losing experiment, an error spike — straight into the user's real session. LaunchDarkly tells you *that* a flag variation moved a metric: a guarded rollout is regressing, an experiment's treatment lost, an error rate climbed right after a flag change. It can't show you what a user who got that variation actually saw. Subtext can. Attach the Subtext session URL to your LaunchDarkly context and every flag signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. LaunchDarkly detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and the LaunchDarkly JS client SDK (`@launchdarkly/js-client-sdk` in v4.x; published as `launchdarkly-js-client-sdk` in earlier versions) is initialized. ## Attach the session URL Store the current Subtext session URL on your LaunchDarkly context so it travels with the flag evaluation and every experiment result. There are two places to attach it, depending on how precise the link needs to be. ### On the LaunchDarkly context Attach the URL as a custom attribute on the context with `ldClient.identify`. Call it wherever your app already identifies the user — on auth resolution, not at module top level. The attribute is stored on the context and visible in the LaunchDarkly **Contexts** dashboard. ```js identify.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { ldClient.identify({ kind: 'user', key: user.id, subtext_url: subtextUrl, }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { ldClient.identify({ kind: 'user', key: user.id, email: user.email, subtext_url: subtextUrl, }) } }, [user]) ``` On the legacy user schema (pre-v3 contexts), nest the value under `custom`: `ldClient.identify({ key: user.id, custom: { subtext_url: subtextUrl } })`. Don't mark `subtext_url` as a private attribute (`privateAttributes` in your SDK config): private attributes are still used for targeting but are redacted from events, so LaunchDarkly won't store the value and it won't be readable from the Contexts page, the REST API, or the MCP tools. ### On a specific event When the exact moment matters, attach the URL to a custom metric event. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal events like errors and conversion failures. ```js theme={null} ldClient.track('checkout_failed', { subtext_url: FS('getSession', { format: 'url.now' }) }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Pass the full context to `ldClient.identify`: it replaces the context rather than merging, so dropping existing attributes clears them. Don't use the session URL as the context `key` — keep the key stable and put the URL in its own attribute. The URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `ldClient.identify` on re-identify — the context attribute is frozen until the next `identify`. ## From signal to session However you first hear that a rollout is going sideways in LaunchDarkly, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. The metric says the new variation is worse; the session shows whether the flagged feature rendered correctly, errored, or just changed behavior people didn't like. LaunchDarkly posts a guarded-rollout / release-monitoring alert to Slack: "Metric `error_rate` regressed for flag `new-checkout` — rollback recommended." From the alert, open the flag and identify contexts that received the regressing variation. Then go to LaunchDarkly → **Contexts**, open one, and copy `subtext_url` from the **Attributes** tab. Grab several, then hand them to your agent: ```text theme={null} LaunchDarkly's guarded rollout flagged a regression on flag `new-checkout` and is recommending rollback. Before I pull the trigger, here are sessions from contexts that got the new variation: Detect-vs-Diagnose, fast: the metric says the new variation is worse — what do these users actually experience? Did the new checkout render and work, or is it broken? Give me a clear roll-back / hold-and-fix recommendation with the evidence behind it. ``` LaunchDarkly emails you that an experiment reached significance — and the treatment lost on a primary metric. Open the experiment, pull contexts in the losing variation, and copy `subtext_url` for a few from **Contexts**. ```text theme={null} LaunchDarkly says the treatment of lost on and it's now significant. Here are sessions from users who got the treatment variation: Open them and tell me whether the feature behaved correctly for these users. Is the metric loss a bug (broken variation) or a preference (it works, users like control better)? That changes whether we iterate or kill it. Point to the moments. ``` Errors spike right after a flag change; you suspect the flag and want proof before reverting. Cross-reference the erroring users to LaunchDarkly contexts, then copy `subtext_url` from **Contexts** → **Attributes**. ```text theme={null} Errors spiked right after we moved flag ``. Here's a session from a user on the new variation who hit trouble: Confirm or rule out the flag: does the new variation's code path break for this user? Show me the UI and console at the failure. I need to decide in the next few minutes whether to revert the flag. ``` Paste the agent's verdict into the flag's comments or the incident channel so the rollout decision is documented with evidence. For a rollback, ask the agent to capture a quick proof document (`doc-create`) with before/after screenshots of the variation, so the "why we rolled back" is permanent. A "metric regressed but the feature works" verdict means iterate; a "feature is broken" verdict means revert now — the session review is what tells the two apart while the rollout clock is ticking. ## For agents An autonomous agent can run the whole loop against LaunchDarkly directly: discover the regressed variation, extract the `subtext_url`, and hand each session to the Subtext MCP. LaunchDarkly is the cleanest experimentation integration for this — the replay link is read back natively as a stored context attribute. LaunchDarkly ships an official MCP server, hosted at `https://mcp.launchdarkly.com/mcp/launchdarkly` (remote, HTTP), with a local stdio server at `github.com/launchdarkly/mcp-server` for federal or EU environments. The hosted server authenticates with OAuth via its install page; the local stdio server authenticates with an API access token created on the Authorization page. See [LaunchDarkly's MCP docs](https://launchdarkly.com/docs/home/getting-started/mcp). It exposes around 100 tools — the relevant ones here are `get-experiment-results`, `get-experiment-metric-results`, `list-experiments`, and `get-experiment` for experiments, and `query-flag-evaluations` to map affected sessions to the variation they received. To read `subtext_url` back, use `search-contexts` or `get-context-instances`, which return stored context attributes. Read experiment results with `get-experiment-results` / `get-experiment-metric-results` (mirrored by the `GET /api/v2/.../experiments...` REST endpoint) to find the variation that regressed, and use `query-flag-evaluations` to map affected sessions and contexts to the variation they received. Read `subtext_url` from the stored context attributes with the MCP tools: `search-contexts` to find the context by kind, key, or attribute value, then `get-context-instances` for its full attribute set. On the local stdio server, which lacks context tools, fall back to REST: discover instances first via `POST` Search context instances or the context-instances list (`filter` e.g. `applicationId`, `sort=ts` / `-ts`, pagination), then GET the instance: ``` GET /api/v2/projects/{projectKey}/environments/{environmentKey}/context-instances/{id} # Authorization: # subtext_url is a custom attribute inside the context object: # context..subtext_url ``` For each URL, call `review-open(session_url=)` on the Subtext MCP, then step through the key moment in the variation for a Detect-vs-Diagnose read: metric regressed vs. did the variation actually break. `subtext_url` only round-trips if it was set as a context attribute at capture time (see [Attach the session URL](#attach-the-session-url)), and the value is frozen at set-time. The documented context model nests custom attributes — including `subtext_url` — inside `context`, but the docs' example response shows `"context": null`, so confirm the exact populated nesting against a live call. Use the local stdio server for EU or federal environments where the hosted endpoint isn't permitted — note that it exposes only a small flag and AI Config toolset (feature flags, AI Configs, audit log, code references, environments), not the experiment or flag-evaluation tools above, so in those environments run the whole discovery and extraction loop over the REST API instead. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # LogRocket and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/logrocket Attach the Subtext session URL to LogRocket, then jump from any LogRocket signal — an error alert, a rage click, a hard-to-read replay — straight into the user's real session. LogRocket flags that a session went wrong: an error fires, a user rage-clicks, a control goes dead. It gives you a replay you can scrub by hand, but it still makes you watch to find out *why*. Subtext turns that into a diagnosis. Attach the Subtext session URL to your LogRocket data and every LogRocket signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. LogRocket detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the LogRocket SDK (`logrocket`) is initialized. ## Attach the session URL Store the current Subtext session URL on your LogRocket data so it travels with the session. There are two places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the LogRocket user with `LogRocket.identify`. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { LogRocket.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { LogRocket.identify(user.id, { name: user.name, email: user.email, subtext_url: subtextUrl, }) } }, [user]) ``` ### On a specific event When the exact moment matters, attach the URL to a custom LogRocket event with `LogRocket.track`. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal moments like errors and conversion failures. ```js theme={null} LogRocket.track('checkout_failed', { reason: error.message, subtext_url: FS('getSession', { format: 'url.now' }), }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Call `LogRocket.init` before `LogRocket.identify` — LogRocket's docs say to initialize as early on the page as possible and document `identify` as a post-init step. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `LogRocket.identify` whenever you re-identify the user. And don't confuse the two replays: `subtext_url` points at the Subtext session, while `LogRocket.getSessionURL` points at the LogRocket recording — store both if you want round-trip linkage. ## From signal to session LogRocket already gives you a replay you can scrub by hand. The Subtext review is the agent-driven read on top of it: paste the `subtext_url`, and your agent (with the Subtext MCP connected) runs `review-open`, steps through the matching session, and pulls screenshots, the component tree, network, and console at the key moments — then hands you a Detect-vs-Diagnose summary instead of asking you to watch the whole thing. However you first hear about a problem in LogRocket, the path is the same: get to the `subtext_url`, then hand it to your agent. You're subscribed to the issue, and LogRocket emails you: *"New error affecting 23 sessions: `checkout_failed`."* Open the issue, pick an affected session, and open the identified user. Go to the **User Traits** panel and copy `subtext_url`. ```text theme={null} LogRocket flagged an error (`checkout_failed`) hitting ~23 sessions. Here's the matching Subtext session for one of them: Open it and give me a Detect-vs-Diagnose read. Did the user actually fail to check out, or did the error fire under the hood while they succeeded? Walk the moments around the failure, show me the UI state and the failing request, and tell me if it reproduces. Summary I can paste into the LogRocket issue. ``` LogRocket posts a Slack alert about a session with rage clicks or a dead click on a key control. Open the flagged session, go to the identified user's traits panel, and copy `subtext_url`. ```text theme={null} LogRocket caught rage clicks in this session. Here's the Subtext session: Find the moment the user started rage-clicking. What were they trying to do, what wasn't responding, and is the control actually broken or just slow/unclear? Tell me whether this is a bug or a design problem, and point me to the exact timestamp. ``` You're already in a LogRocket session, scrubbing, and it's not obvious what went wrong. Grab `subtext_url` from the user's traits in that same session (store both replays at capture time so this round-trip always works). ```text theme={null} I'm looking at a LogRocket replay for user and I can't tell what broke. Here's the matching Subtext session: Cross-reference it: confirm whether the error visible in LogRocket reproduces, describe the UI state and the exact action sequence that triggered it, and tell me the one thing I should fix. ``` After the review, paste the agent's summary back into the LogRocket issue so it carries a diagnosis, not just a replay link. Keep both links together — the `subtext_url` and the LogRocket session URL — so anyone can pick the read they prefer. For friction that spans several sessions — like an error hitting 23 of them — ask your agent to roll the findings into one proof document (`doc-create`) with a screenshot per session and a single shared link, then drop that link into the LogRocket issue. And if the review shows the error is cosmetic or self-recovering, mark the LogRocket issue accordingly: a thrown error is not a blocked user. ## For agents An autonomous agent can drive the same loop against LogRocket — discover the friction, get to the `subtext_url`, and hand each session to the Subtext MCP — but LogRocket is the odd integration on both ends. There is no structured friction REST API (rage clicks, dead clicks, and error sessions are dashboard- and Galileo-only), and user traits are write-only over the API (the User Identification API `PUT .../users/` *sets* traits, but there is no public GET to read them back). LogRocket does ship an official MCP server at `https://mcp.logrocket.com/mcp`, authenticated with OAuth or an API key as `Authorization: Bearer `; no community server exists. Use it to *find* the friction session, but extract `subtext_url` from a store you can read back. Call the LogRocket MCP's `find_sessions` or `use_logrocket` (natural-language via Galileo) — ask something like "sessions with rage clicks on /checkout in the last 24h" and get matching sessions back. This is the discovery step the REST API can't do. The Galileo Highlights API (`POST https://api.logrocket.com/v1/orgs//apps//highlights/`) exists but is user-scoped (`userID`/`userEmail` required), async, and capped at 10 recent sessions over 30 days — not a fleet-wide friction query. There is no public read endpoint for LogRocket user traits, so read `subtext_url` from a store that captured it at the same time — a Sentry event tag, PostHog/Amplitude, or your warehouse. If LogRocket is your only store, fall back to the LogRocket session URL (from `find_sessions` or `LogRocket.getSessionURL`) and pair it with the Subtext session by hand. For each readable URL, call `review-open` on the Subtext MCP: ```text theme={null} review-open(session_url=) # Subtext MCP # → Detect-vs-Diagnose: error/rage signal vs. user actually blocked ``` `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)) and stored somewhere you can read back. Treat LogRocket as a discovery surface and a secondary replay, not the source of truth for the Subtext link. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Metabase and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/metabase Format the Subtext session URL as a clickable link in Metabase, then jump from any dashboard tile, question, or alert straight into the user's real session. Metabase shows you *that* a number moved: a funnel dropped, an error-rate tile climbed, a cohort in a table looks wrong. It reads your warehouse and charts the shape of the problem, but it can't show you the moment one specific person hit it. Subtext can. Point Metabase at a `subtext_url` column your collector already landed and every dashboard row becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Metabase detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and that Metabase is connected to a warehouse table with a `subtext_url` column that a collector (Snowplow, Hightouch, Segment, or direct inserts) already landed. ## Attach the session URL Metabase doesn't capture anything — it reads a `subtext_url` column your collector already landed in the warehouse. Attaching the link is configuration, not code: return the column in a question, then format it as a link so every row opens the session. The examples assume ClickHouse, but the steps are identical on any warehouse Metabase connects to. ### Return the column in a question Write a question that selects `subtext_url` alongside whatever you are analyzing: ```sql theme={null} SELECT user_id, event, event_time, subtext_url FROM events WHERE event = 'checkout_error' AND subtext_url != '' ORDER BY event_time DESC LIMIT 50 ``` ### Format the column as a link In the question's visualization settings, open the `subtext_url` column and set **Display As → Link**. The column already holds a full URL, so the link template is just the value itself. Store the full `subtext_url` as captured — the signed URL originates in the browser via `FS('getSession')` and can't be reconstructed from a bare session id, so a link template can't rebuild it: ```text Full URL column theme={null} {{subtext_url}} ``` Set **Link text** to `Open session` (or leave it blank to show the URL). Now every row renders an **Open session** link that opens the replay in a new tab. ### Make it stick with a model Set the formatting once on a Metabase **model** and every question and dashboard built on that model inherits the clickable link automatically. Add the `subtext_url` column to the model, set its display to **Link** in the model's metadata, and downstream questions render it without re-configuring. Don't put a question that exposes `subtext_url` into a **public link** or **static embed** — the signed URL grants replay access, so keep these questions and dashboards to authenticated, internal users. Don't wrap the raw URL in `LowCardinality` upstream or truncate it in the query; the full signed string is required for the link to resolve. And don't rely on the link for rows written before the collector attached `subtext_url` — filter `subtext_url != ''` so empty rows don't render dead links. ## From signal to session However you first hear about a problem in Metabase, the path is the same: click the **Open session** link, grab the `subtext_url`, and hand it to your agent for a Detect-vs-Diagnose read — the dashboard says these users errored or dropped; the session shows what they actually experienced. The analyst or growth PM reviewing the weekly funnel dashboard sees a funnel or error-rate tile below trend. The linked question lists the affected users, each row with an **Open session** link. Click into the question behind the tile and copy a few **Open session** links (or right-click → copy link). Then hand them to your agent: ```text theme={null} Our Metabase funnel dashboard shows checkout conversion below trend. Here are session URLs for users who started but didn't complete: Review them and find the common failure point. Detect-vs-Diagnose: the data says they dropped — what does each session actually show at the drop step? One synthesized hypothesis at the end. ``` The data analyst exploring ad-hoc slices a question and one segment looks wrong — high error rate, low completion. Each row already carries an **Open session** link. ```text theme={null} This segment in my Metabase question has an unusually high error rate. Here are a few of their sessions: Open them and tell me what's breaking for this segment specifically. Is it one bug, or a few different failures that happen to cluster here? ``` A Metabase alert on a question crosses its threshold (error count spikes, conversion drops) and emails anyone subscribed to it. Open the question from the alert email; the offending rows carry **Open session** links. ```text theme={null} A Metabase alert fired: `checkout_error` crossed its threshold this hour. Here's a session from the alerting query: Open it around the error and tell me whether this is a new regression or the same known issue. Show me the UI and console at that moment. ``` For a funnel investigation across several users, ask your agent to consolidate its findings into one proof document (`doc-create`) with a screenshot per dropped user and a single shareable link — then drop that back into the dashboard's description so the tile carries the human story behind it. ## For agents An autonomous agent can run the whole loop against Metabase: run the analysis your team already trusts, extract the `subtext_url`, and hand each session to the Subtext MCP. Metabase ships an official first-party MCP server (Metabase 60+, available on all plans), built into your instance and served from the `/api/metabase-mcp` endpoint. Clients authenticate via OAuth 2.0 against Metabase's embedded OAuth server, with tokens scoped to the connecting user's Metabase permissions, and it requires AI features to be enabled — if AI features are off in **Admin > AI**, the MCP server stays off. Its read-only tools — `search`, `read_resource`, `construct_query`, `execute_query`, `query` — run queries and return rows with column metadata. The Metabase REST API remains an alternative path, and `POST /api/card//query/json` is still the single-call way to run a saved question: the MCP server has no run-card-by-id tool, so an agent reads the question via `read_resource` (`metabase://question/`) and then constructs and executes its query. Metabase is a convenience layer over your warehouse, so you can also skip it entirely and query the underlying warehouse through its own MCP (for ClickHouse, the official `mcp-clickhouse` server). The official server also exposes write tools (`create_question`, `execute_sql`, and more), so connect as a Metabase user with read-only permissions — the OAuth token inherits that user's permissions — and note that an admin can disable `execute_sql` instance-wide via the `mcp-execute-sql-enabled` setting. Run the saved question (card) that already encodes the funnel, error, or cohort analysis — a card contains the exact analysis your team trusts. Via the official Metabase MCP server or the REST API directly: ```text theme={null} POST https:///api/card//query/json # Header: x-api-key: # → array of row objects, each including the subtext_url field ``` Read `subtext_url` off the returned rows: ```text theme={null} rows = POST /api/card//query/json # Metabase REST or the official Metabase MCP urls = [r.subtext_url for r in rows if r.subtext_url] ``` To build the query fresh instead, run SQL against the warehouse MCP directly for the same rows. For each URL, call `review-open(session_url=)` on the Subtext MCP and step through the drop or error moment for a Detect-vs-Diagnose read. The card must actually select `subtext_url` and filter out empty values, or the field won't be in the result — check the question's columns first. A card returns whatever row limit the question sets, so raise it or paginate for a full cohort. Use read-only credentials on whichever surface you pick: a review agent only reads. And `subtext_url` only round-trips if a collector attached it (see [Attach the session URL](#attach-the-session-url)). ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Mixpanel and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/mixpanel Attach the Subtext session URL to Mixpanel, then jump from any Mixpanel signal — an Insights alert, a board digest, a funnel drop — straight into the user's real session. Mixpanel tells you *that* a metric moved: a purchase rate dropped, an event spiked, a funnel leaked at one step. It lets you cohort the people behind the number, but it can't replay what any one of them actually experienced. Subtext can. Attach the Subtext session URL to your Mixpanel profiles and events and every Mixpanel signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Mixpanel detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the Mixpanel JS SDK is initialized. ## Attach the session URL Store the current Subtext session URL on your Mixpanel data so it travels with the signal. There are three places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the Mixpanel person profile with `mixpanel.people.set`. Call it wherever your app already identifies the user — after identity resolves, not at module top level, and never for an anonymous user. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { mixpanel.people.set({ subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { mixpanel.people.set({ subtext_url: subtextUrl }) } }, [user]) ``` ### On every event Register the URL as a super property and it rides along on every subsequent event automatically. The value is frozen at registration time. ```js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { mixpanel.register({ subtext_url: subtextUrl }) } ``` To clear it, call `mixpanel.unregister('subtext_url')`. ### On a specific event When the exact moment matters, pass the URL directly on a single `track` call. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal events like errors, rage clicks, and conversion failures. ```js theme={null} mixpanel.track('checkout_failed', { reason: error.message, subtext_url: FS('getSession', { format: 'url.now' }), }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't call `mixpanel.people.set` for anonymous users; attach the profile property only after the user is identified. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-attach on re-identify. Super properties are frozen at set-time; re-register them. ## From signal to session However you first hear about a problem in Mixpanel, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Mixpanel flagged the drop or spike; the session shows the actual cause. A Mixpanel alert fires by email or Slack: "`Purchase` is down 20% vs. the 7-day average." From the alert, open the report and build or filter to users who started but didn't purchase. Open a user profile, find `subtext_url` in the properties list, and copy it. Grab several, then hand them to your agent: ```text theme={null} Mixpanel alerted me that Purchase is down 20%. Here are sessions from users who started but didn't complete a purchase in that window: Review them and find the shared failure point. Detect-vs-Diagnose: Mixpanel flagged the drop — what does each session actually show at the purchase step? One root-cause hypothesis at the end, with the moments that back it. ``` The team's Mixpanel board arrives on a schedule and the digest shows a key conversion sliding over the week. Click into the report, segment to the affected users, open their profiles, and copy `subtext_url`. ```text theme={null} Our Mixpanel board shows sliding this week. Here are sessions from users in the affected segment: Walk each one through the relevant flow. Where do they drop, and is it consistent? Tell me if this is a real regression or noise, and show me the evidence. ``` You build a Mixpanel funnel, spot a steep drop at one step, and click into the non-converters. Open a non-converting user's profile and copy `subtext_url`. ```text theme={null} I'm looking at a Mixpanel funnel with a steep drop at . Here's a user who didn't convert there: Open the session and tell me exactly what happened at that step — what they saw, what they tried, and why they stopped. Bug, friction, or intent? Point me to the timestamp. ``` For a drop-off across several users, ask your agent to roll the findings into one proof document (`doc-create`) with a screenshot per session and a single shared link — then paste that back into the Mixpanel report description so the metric carries its explanation. If the review shows the drop is user intent rather than a defect, say so plainly; it keeps engineering from chasing a step that works. ## For agents An autonomous agent can run the whole loop against Mixpanel directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Mixpanel ships an official MCP server (hosted) documented at `docs.mixpanel.com/docs/mcp`, authenticated with OAuth or a Service Account (Service Account authentication for the MCP server is still in beta). It's good for natural-language *discovery* over funnels, flows, and session replays, and its tool registry is documented on the same page — `Run-Query` executes insights, funnels, flows, and retention queries, `Get-Report` retrieves saved reports, and `Get-User-Replays-Data` analyzes a user's session replays. None of the published MCP tools read individual profile properties, though. For deterministic `subtext_url` extraction, drive the REST Query and Engage APIs below, and use a Service Account for a headless agent. Hit the Query API to locate friction. Query a saved report via the Insights Query API — `GET /api/query/insights` with `project_id` and `bookmark_id` — to read per-step conversion from a saved Funnels report, and use `/api/query/retention` for retention. The base host is `https://mixpanel.com/api/query/...` (US) or `https://eu.mixpanel.com/api/query/...` (EU), authenticated with Service Account Basic auth plus `project_id`. Avoid the Funnels (`/api/query/funnels`), Segmentation (`/api/query/segmentation`), and JQL (`/api/query/jql`) endpoints for new work — they're all in maintenance mode. Read `subtext_url` per user from the Engage (Query Profiles) API: ```text theme={null} POST https://mixpanel.com/api/query/engage # EU: https://eu.mixpanel.com/api/query/engage # Auth: Service Account Basic auth, project_id param # Params: distinct_id=, output_properties=["subtext_url"] # → results[N].$properties.subtext_url ``` `output_properties` returns just that property for a smaller, faster payload. To find every user with a session attached, pass a `where` filter like `defined(properties["subtext_url"])`. For each URL, call `review-open(session_url=)` on the Subtext MCP. Event-level URLs are moment-precise, so the review opens exactly when the signal fired. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)). Match your region host (`mixpanel.com` vs `eu.mixpanel.com` / `in.mixpanel.com`) for both the Query and Engage APIs, and prefer a Service Account over OAuth for headless agents. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # New Relic and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/newrelic Attach the Subtext session URL to New Relic browser events, then jump from any New Relic signal — an open issue, an Errors Inbox group, a rage click — straight into the user's real session. New Relic tells you *that* something crossed a line: an issue opened, an error group grew, rage clicks climbed on a dashboard. It can't tell you *why* one specific person was blocked. Subtext can. Attach the Subtext session URL to your browser events and every New Relic signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. New Relic detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the New Relic browser agent is running — either the copy-paste snippet or the `@newrelic/browser-agent` npm package. Both expose the same `newrelic` global, so every call below works unchanged. ## Attach the session URL Store the current Subtext session URL on your New Relic browser data so it travels with the signal. There are three places to attach it, depending on how precise the link needs to be. ### On every browser event `setCustomAttribute` adds a name/value pair to subsequent events on the page. Pass `true` as the third argument and the pair is also written to browser storage, so later same-origin page loads in the same session re-apply it automatically. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { newrelic.setCustomAttribute('subtext_url', subtextUrl, true) newrelic.setUserId(user.id) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { newrelic.setCustomAttribute('subtext_url', subtextUrl, true) newrelic.setUserId(user.id) } }, [user]) ``` The attribute lands on `AjaxRequest`, `BrowserInteraction`, `BrowserPerformance`, `JavaScriptError`, `Log`, `PageAction`, `PageView`, `PageViewTiming`, and `UserAction` — so a single call makes the session URL queryable from almost anywhere in NRQL. `setUserId` is worth pairing with it. It writes `enduser.id` on every event, persists across page loads on its own, and is attached to `JavaScriptError` specifically so Errors Inbox can group by user. ### On a specific action When the exact moment matters, attach the URL to a `PageAction`. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal moments like checkout failures and conversion drop-offs. ```js theme={null} newrelic.addPageAction('checkout_failed', { reason: error.message, subtext_url: FS('getSession', { format: 'url.now' }), }) ``` ### On a handled error For an error you catch yourself, pass the URL as a custom attribute on `noticeError`. It lands on the `JavaScriptError` event alongside the stack trace. ```js theme={null} try { await submitPayment(payload) } catch (err) { newrelic.noticeError(err, { subtext_url: FS('getSession', { format: 'url.now' }) }) } ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Custom attribute values must be simple types: string, number, boolean, or `null`. A session URL is a string, so it fits, but passing an object silently fails. To land the attribute on the `PageView` event specifically, set it before the window load event fires; that's when `PageView` is transmitted. Avoid reserved NRQL words for attribute names. The `persist` argument needs browser agent v1.230.0 or higher. ## From signal to session However you first hear about a problem in New Relic, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. New Relic tells you a threshold broke or an error group grew; the session tells you whether a real person was actually blocked, what they saw, and the precise sequence behind it. An alert condition trips, New Relic opens an issue, and your workflow pages the on-call engineer: "Browser JS error rate above threshold on `/checkout`." Open the issue, jump to the correlated events, and copy `subtext_url` from a representative one. Or run it directly in the query builder: ```sql theme={null} FROM JavaScriptError SELECT subtext_url, `enduser.id`, errorMessage, pageUrl WHERE pageUrl LIKE '%/checkout%' AND subtext_url IS NOT NULL SINCE 30 minutes ago LIMIT 10 ``` ```text theme={null} A New Relic issue paged me: browser JS error rate spiking on /checkout. Here's a session from an affected user: It's 2am — I need signal fast. Open the session, give me a Detect-vs-Diagnose read. Is this a real user-facing outage or noisy telemetry? What broke, what did the user see, and is it isolated or systemic? One paragraph, plus the single most important screenshot. ``` Errors Inbox groups a recurring `Uncaught TypeError` across dozens of sessions and assigns it to you. Open the group and read `subtext_url` off several events — because you set `enduser.id`, you can also see how many distinct people hit it, not just how many events fired. ```sql theme={null} FROM JavaScriptError SELECT uniqueCount(`enduser.id`), latest(subtext_url) WHERE errorMessage LIKE '%Cannot read properties%' FACET errorMessage SINCE 1 hour ago ``` ```text theme={null} New Relic Errors Inbox flagged a recurring error across ~60 sessions. Here are subtext_urls from a sample: Review them together. What's the common trigger — same component, same API failure, same device? Which sessions show the user actually stuck vs. recovered? Give me one root-cause hypothesis and a go/no-go on whether this needs a hotfix tonight. ``` Nothing paged you. You want to find the friction New Relic noticed but nobody thresholded. The browser agent classifies user actions on its own. `rageClick`, `deadClick`, and `errorClick` are plain boolean attributes on `UserAction`, so the sweep is one query: ```sql theme={null} FROM UserAction SELECT session, subtext_url, currentUrl, actionName, deviceType WHERE (rageClick IS true OR deadClick IS true OR errorClick IS true) AND subtext_url IS NOT NULL SINCE 1 day ago LIMIT 50 ``` ```text theme={null} New Relic flagged rage and dead clicks across these sessions: Open each one and tell me what the user was trying to do at the moment they started clicking repeatedly. Is the control broken, mislabeled, or just slow? Rank the findings by how many people this would affect. ``` New Relic session replay and Subtext do different jobs. Filter on `hasReplay IS true AND subtext_url IS NOT NULL` and you get sessions with both: a New Relic replay a person can watch, and a Subtext session your agent can read. For a postmortem, ask your agent to assemble a proof document (`doc-create`) with the key screenshots and the session link, then drop it into the incident channel so the metrics chart gets a human-impact caption. ## For agents An autonomous agent can run the whole loop against New Relic directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. New Relic hosts a first-party MCP server over Streamable HTTP at `https://mcp.newrelic.com/mcp/` (US), `https://mcp.eu.newrelic.com/mcp/` (EU), and `https://mcp.jp.newrelic.com/mcp/` (JP). Authenticate with a user API key in an `api-key` header (`NRAK-…` format) or with OAuth. Clients that need stdio can bridge with `npx mcp-remote`. New Relic's MCP server accepts an `include-tags` header that filters which tools the agent sees. The available tags are `discovery`, `data-access`, `alerting`, `incident-response`, `performance-analytics`, and `advanced-analysis`. For the Subtext loop, `include-tags: data-access,incident-response` is enough — it trims the tool corpus to the ones below and leaves more room for the review itself. `execute_nrql_query` is the core discovery tool — everything in the section above is one NRQL string. For grouped errors, `list_entity_error_groups` pulls Errors Inbox groups for an entity within a time window. `list_recent_issues` and `search_incident` cover open issues and alert events. `generate_user_impact_report` produces an end-user impact analysis for a specific issue, which is a natural place to hand off. `natural_language_to_nrql_query` writes and runs the query for you when you'd rather describe the question than compose NRQL. Without the MCP, the same over NerdGraph: ```graphql theme={null} { actor { account(id: YOUR_ACCOUNT_ID) { nrql(query: "FROM UserAction SELECT subtext_url WHERE rageClick IS true SINCE 1 day ago") { results } } } } ``` ``` POST https://api.newrelic.com/graphql # API-Key: NRAK-... (api.eu.newrelic.com / api.jp.newrelic.com for other regions) ``` Because `setCustomAttribute` writes to every browser event type, one `SELECT subtext_url` does the job on whichever event carries the signal — `JavaScriptError` for errors, `UserAction` for friction, `PageAction` for the moments you instrumented yourself. Add `WHERE subtext_url IS NOT NULL` to skip sessions captured before the attribute was attached; inverting it to `IS NULL` surfaces your capture gaps. For each URL, call `review-open(session_url=)` on the Subtext MCP. `PageAction` and `noticeError` links are moment-precise, so the review opens exactly when the signal fired. For an incident, scope the NRQL to the incident window first, then review a session from inside the spike. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)). Links set through `addPageAction` or `noticeError` are moment-precise; the persisted custom attribute opens at the moment the user was identified. `UserAction` events and the `rageClick` / `deadClick` / `errorClick` attributes require the Pro or Pro+SPA browser agent at v1.268.0 or higher — they are not reported by the Lite agent. Match your New Relic region (US/EU/JP) for the MCP endpoint and the NerdGraph host. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # OpenTelemetry and Subtext: From a Trace to the Session Source: https://subtext.fullstory.com/docs/integrations/opentelemetry Link the Subtext session to your OpenTelemetry traces, then jump from any red trace — a latency alert, an error spike, an incident dashboard — straight into the user's real session. OpenTelemetry is the open, vendor-neutral standard for tracing your backend: spans and attributes flow through it to whatever OTLP-compatible observability backend you run — Grafana Cloud / Tempo, Honeycomb, or anything else. A trace tells you *that* a span crossed a latency threshold or exited with an error. It can't tell you *whether* a real person was actually blocked, what they saw, or the exact sequence behind it. Subtext can. Link the Subtext session to your traces — the session id rides along in Baggage, the clickable session URL sits on the root span — and every red trace becomes a jumping-off point: your agent reads `subtext.session.url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. OpenTelemetry detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, the OpenTelemetry JS web SDK is running in your browser app (`@opentelemetry/sdk-trace-web` plus fetch/XHR instrumentation), and you have an OTLP-compatible tracing backend. The examples use Grafana Cloud / Tempo, but any OTLP backend works. ## Attach the session URL Session replay is your front-end telemetry; OpenTelemetry is your back-end telemetry, and wiring the seam links them both directions. Put the Subtext session id in Baggage so it propagates to the backend, stamp the clickable session URL on the root span, and — so the link runs the other way too — stamp the active trace id back onto the session. Elsewhere in these guides the key is `subtext_url`; on OpenTelemetry spans it follows OTel attribute-naming conventions as `subtext.session.url` / `subtext.session.id`. Keep the browser footprint minimal; you are not replacing session replay, only linking to the trace. ### Set up browser tracing Register a `WebTracerProvider` with the W3C trace-context and Baggage propagators, and scope trace-header injection to your own API origins. ```js theme={null} import { WebTracerProvider } from '@opentelemetry/sdk-trace-web' import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base' import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http' import { ZoneContextManager } from '@opentelemetry/context-zone' import { CompositePropagator, W3CTraceContextPropagator, W3CBaggagePropagator, } from '@opentelemetry/core' import { registerInstrumentations } from '@opentelemetry/instrumentation' import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch' const provider = new WebTracerProvider({ spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({ url: '/v1/traces' }))], }) provider.register({ contextManager: new ZoneContextManager(), propagator: new CompositePropagator({ propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()], }), }) registerInstrumentations({ instrumentations: [ new FetchInstrumentation({ // Only inject traceparent/baggage to your own API origins (never third-party). propagateTraceHeaderCorsUrls: [/^https:\/\/api\.yourapp\.com/], }), ], }) ``` ### Put the session id in Baggage Once capture has started, put `subtext.session.id` in Baggage so it propagates to the backend. The `format: 'id'` option returns the bare session id — see [Fullstory's Get Session Details docs](https://developer.fullstory.com/browser/get-session-details/). Wrap the code that should carry the session id forward — `context.with()` only threads the baggage into the callback you pass it. ```js theme={null} import { propagation, context } from '@opentelemetry/api' // Wrap this around the code that should carry the session id forward — e.g. // your app's render/bootstrap call, or a request handler. context.with() // only threads the baggage into the callback you pass it (and, with // ZoneContextManager, into async work scheduled from inside that callback — // fetches, timers, promise chains). Code that runs after context.with() // returns, outside the callback, never sees it. export function attachSubtextSession(next) { const sessionId = FS('getSession', { format: 'id' }) if (!sessionId) return next() const baggage = (propagation.getActiveBaggage() ?? propagation.createBaggage()).setEntry( 'subtext.session.id', { value: String(sessionId) } // W3C Baggage values must be strings ) return context.with(propagation.setBaggage(context.active(), baggage), next) } ``` Call it once capture has actually started, not at module top level: ```js theme={null} FS('observe', { type: 'start', callback: () => attachSubtextSession(() => renderApp()), }) ``` This wrap covers the initial load and async work rooted in it. For robustness, also re-establish baggage at your request boundary (wrap your fetch/data layer, or set it in a `FetchInstrumentation` request hook) so every outbound request carries `subtext.session.id`, not just those rooted in the initial render. ### Set the session URL on the root span Stamp the clickable `subtext.session.url` on the root span with a `SpanProcessor`, which keeps it out of the propagated header. Never put the URL in Baggage. ```js theme={null} import { trace } from '@opentelemetry/api' class SubtextRootAttributeProcessor { onStart(span, parentContext) { // Root span only: no parent span in the context the SDK resolved for this span. if (trace.getSpan(parentContext)) return const url = FS('getSession', { format: 'url.now' }) if (url) span.setAttribute('subtext.session.url', url) } onEnd() {} shutdown() { return Promise.resolve() } forceFlush() { return Promise.resolve() } } // Add alongside BatchSpanProcessor in WebTracerProvider({ spanProcessors: [...] }). ``` After wiring, confirm in a live request that the outbound call carries both a `traceparent` and a `baggage: subtext.session.id=...` header. ### Promote Baggage onto backend spans So every server span carries the session id, add the Baggage span processor (OTel contrib) in each backend service. ```bash theme={null} npm i @opentelemetry/baggage-span-processor ``` ```js theme={null} import { BaggageSpanProcessor } from '@opentelemetry/baggage-span-processor' // Copy only the Subtext session id onto spans. ALLOW_ALL_BAGGAGE_KEYS (also // exported by this package) copies every baggage entry — skip it here so a // key some other tool later adds to baggage doesn't silently land on every // span attribute too. const subtextBaggageProcessor = new BaggageSpanProcessor((key) => key === 'subtext.session.id') // Add subtextBaggageProcessor alongside your other span processors on the // NodeTracerProvider / NodeSDK spanProcessors array. ``` `BaggageSpanProcessor` only has baggage to read if the Node tracer extracts the incoming `baggage` header. The OpenTelemetry JS NodeSDK does this by default (`OTEL_PROPAGATORS` defaults to `tracecontext,baggage`); if you've narrowed the propagators, add the W3C Baggage propagator back or `subtext.session.id` never enters server context. ### Stamp the trace id back onto the session Stamp the active trace id onto the Fullstory session so a session action deep-links to the backend trace. This is your app's instrumentation, not automatic capture-snippet behavior — call it wherever your code can see the trace you want linked. It stamps one `otel_trace` event per call. ```js theme={null} import { context, trace } from '@opentelemetry/api' const span = trace.getSpan(context.active()) const ctx = span?.spanContext() if (ctx) { FS('trackEvent', { name: 'otel_trace', properties: { trace_id: ctx.traceId, span_id: ctx.spanId }, }) } ``` `FS('getSession', { format: 'id' })`, `FS('observe')`, and `FS('trackEvent')` are Fullstory Browser API operations not covered in Subtext's API pages — see the Fullstory developer docs and verify them against your installed snippet version. Likewise verify the `@opentelemetry/*` import paths and the `@opentelemetry/baggage-span-processor` exports (`BaggageSpanProcessor`, `ALLOW_ALL_BAGGAGE_KEYS`) against your installed versions; the JS and contrib API surfaces shift between releases. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started; call it from `FS('observe', { type: 'start', callback })`. Don't put `subtext.session.url` in Baggage — it is long and grants replay access, and Baggage rides every hop into logs and headers, so propagate only `subtext.session.id`. Scope `propagateTraceHeaderCorsUrls` to your own API origins (never third-party), and accept the `traceparent` and `baggage` headers in your API's CORS config or the browser drops them. Keep user PII out of span attributes and baggage. The session id and URL change on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-wrap the following work in another `attachSubtextSession(next)` on re-identify — the value is frozen at set-time and won't refresh on a bare re-read. Interesting traces (errors, high latency, session-flagged) must survive sampling. Use tail-based sampling at the OpenTelemetry Collector — keep 100% of error / high-latency traces and sample the rest — rather than dropping traces head-side in the browser. ## From signal to session However you first cross the seam — an alert, a dashboard panel, or a session someone already has open — the path is the same: get to the `subtext.session.url`, then hand it to your agent for a Detect-vs-Diagnose read. The trace tells you a span crossed a latency threshold or errored; the session tells you whether a real person was actually blocked, what they saw, and the precise sequence behind it. Because `subtext.session.id` rides in Baggage and lands on every backend span for a request, you can also search Tempo by session id for every trace generated during one session: ``` { span.subtext.session.id = "" } ``` (Attribute-equality and TraceQL syntax vary by Tempo version — confirm against your instance.) A Grafana alert pages you (PagerDuty, Slack, whatever's wired up): *"P99 latency on checkout-service > 2s for 5m."* Open the alert, jump to Explore → Tempo, and run a TraceQL query scoped to the alerting window for slow, session-tagged traces: ``` { duration > 2s && span.subtext.session.url != "" } ``` That single-span form matches when the *root* span is the slow one. If the slowness is in a child span, split it into two spansets so TraceQL matches across spans in the same trace: ``` { span.subtext.session.url != "" } && { duration > 2s } ``` Open a matching trace, find the root span — that's the one carrying the attribute — and copy `subtext.session.url`. Then hand it to your agent: ```text theme={null} A Grafana alert paged me: P99 latency on checkout-service breached 2s. Here's a session from a trace that got caught in the same query: It's 2am — I need signal fast. Open the session, give me a Detect-vs-Diagnose read. Is this a real user-facing slowdown or a backend blip nobody noticed? What did the user see, and is it isolated or systemic? One paragraph, plus the single most important screenshot. ``` A Slack alert posts: *"Error rate on POST /checkout up 4x in the last 15 minutes."* In Grafana → Explore → Tempo, run: ``` { status = error && span.subtext.session.url != "" } ``` Since `subtext.session.url` lives on the root span only, this matches only traces where the *root* span itself errored. To also catch a session-tagged trace where the error surfaced on a child span, split the conditions into separate spansets: ``` { span.subtext.session.url != "" } && { status = error } ``` Open a handful of the matching traces, copy `subtext.session.url` off each, and review them together: ```text theme={null} Tempo is showing a 4x spike in errors on /checkout. Here are sessions from a sample of the affected traces: Review them together. What's the common trigger — same downstream call, same input, same device? Which sessions show the user actually stuck vs. recovered? Give me one root-cause hypothesis and a go/no-go on whether this needs a hotfix tonight. ``` A customer writes in: *"Checkout just hung on me, I had to refresh."* Support already has the Subtext session link for that visit — from the in-app support widget or a saved bookmark — but no trace id yet. Open the session in Subtext and step through it up to the point it hangs. Find the `otel_trace` custom event on the session timeline — your app's instrumentation stamps one onto the session for the trace it wants linked. Open its properties and copy `trace_id` (and `span_id` if you want the exact span). In Grafana → Explore → Tempo → TraceQL tab, paste the trace id directly into the query field to jump straight to that trace — an exact id lookup, no TraceQL query needed. ```text theme={null} A customer says checkout hung on them. Here's their session: Open it, confirm what happened on screen, then pull the `otel_trace` event and tell me the trace_id. I want to hand that to backend on-call so they can pull up the exact trace in Tempo and see which downstream call actually stalled. ``` During or after an incident, a Grafana dashboard panel shows a clear anomaly window — a latency or error-rate spike correlated with a drop in conversions. From the dashboard panel, drill down to Explore → Tempo, scope the TraceQL query to the incident window, and filter for session-tagged traces inside the spike: ``` { status = error && span.subtext.session.url != "" } ``` For a pure latency spike, swap in the `duration > ` filter from the first scenario; use the split-spanset variant if the error or slow span surfaced on a child span. Open a trace inside the window, copy `subtext.session.url`, and hand it over: ```text theme={null} We had an incident between and . This Grafana dashboard shows spiking against a conversion drop. Here's a user session from inside that window: Open it and tell me the human story behind the graph — what did this user try to do, where did it fail, and what did the failure look like on screen? I'm writing the postmortem; I need the customer-impact narrative, not just the metrics. ``` For an incident, ask your agent to roll the sessions into one proof document (`doc-create`) with the key screenshots and a single shared link — then drop it into the postmortem or incident channel so the trace graph carries its human-impact caption. If the session proves the alert was noise (a span errored or was slow, but the user was unaffected), feed that back into your Collector's tail-sampling policy or your alert threshold. ## For agents An autonomous agent can run the whole loop against your tracing backend directly: discover the error or high-latency traces, extract the stamped `subtext.session.url`, and hand each session to the Subtext MCP. Grafana ships a first-party MCP server two ways: the open-source [`grafana/mcp-grafana`](https://github.com/grafana/mcp-grafana), which you run locally (stdio via `uvx mcp-grafana`, a downloaded binary, or `go install`) or self-host (Streamable-HTTP/SSE via Docker or the Helm chart) authenticated with `GRAFANA_URL` + `GRAFANA_SERVICE_ACCOUNT_TOKEN`; and, for Grafana Cloud, a hosted MCP server at `https://mcp.grafana.com/mcp` (Streamable HTTP, OAuth 2.1, public preview). Trace search isn't built into `mcp-grafana` — it's proxied from Tempo's own MCP server, exposed as `tempo_`-prefixed tools only when your Tempo datasource has that server enabled (`query_frontend.mcp_server.enabled`) and `mcp-grafana` wasn't started with `--disable-proxied`. List the live server's tools first; if `tempo_traceql-search` isn't there, that's why — fall back to the same TraceQL a human pastes into Grafana Explore. Use `tempo_get-attribute-names` / `tempo_get-attribute-values` to confirm `subtext.session.url` is actually indexed before you query on it. Run `tempo_traceql-search` with the same queries a human would paste into Explore: ``` { duration > 2s && span.subtext.session.url != "" } # slow + session-tagged { status = error && span.subtext.session.url != "" } # errored + session-tagged ``` Because `subtext.session.url` lives on the root span only, neither matches a trace where the error or slow span is a *child* span. Split into two spansets so TraceQL matches across spans in the same trace: ``` { span.subtext.session.url != "" } && { status = error } # errored child span { span.subtext.session.url != "" } && { duration > 2s } # slow child span ``` If the search response already carries the root span's attributes, read `subtext.session.url` off it directly. Otherwise — or if you matched via the split-spanset query — call `tempo_get-trace(trace_id)` for the full trace, find the root span (no parent span reference), and read `subtext.session.url` from its attributes. Verify the exact response shape (attribute key casing, nesting) against a live call. For each URL, call `review-open(session_url=)` on the Subtext MCP. The root-span URL is captured with `url.now`, so the review opens deep-linked to the moment the trace ran. Starting from a session instead of a trace (a support ticket with a `subtext.session.url` and no trace id yet): `review-open` the session, walk the timeline to the `otel_trace` custom event, read `trace_id` (and `span_id`) off its properties, then `tempo_get-trace(trace_id)` for an exact id lookup — no TraceQL query needed. The examples use Grafana Cloud / Tempo, but OpenTelemetry is vendor-neutral — spans and attributes flow to whatever OTLP backend you run. Honeycomb, for instance, ships its own hosted MCP server (plus a Query Data API); the pattern is identical: discover traces filtered on `subtext.session.url != ""` plus your latency/error condition, extract the attribute, then run the same `review-open` hand-off. `subtext.session.url` only round-trips if it was attached to the root span at capture time, and TraceQL syntax and the `mcp-grafana` / proxied `tempo_` tool names and params shift between releases — confirm both against your current server before wiring an automation on top of this recipe. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL or id exists to attach. # Integrations: Jump from Your Tools into the Session Source: https://subtext.fullstory.com/docs/integrations/overview Attach the Subtext session URL to the analytics, monitoring, and product tools you already use, so any signal links straight to the user's real session. Subtext meets your agent where it already looks. Attach the Subtext session URL (`subtext_url`) to the tools that flag problems — analytics, error monitoring, product platforms, your warehouse — and every signal becomes a one-click path into the session that explains it. The tool detects; Subtext diagnoses. Each integration guide covers the same three things: how to **attach** the session URL in your code, how a **person** gets from a signal to a review, and how an **agent** can run the same loop end to end. ## Analytics and CDP Link any PostHog funnel drop, exception, or alert to the session behind it. Jump from an Amplitude anomaly, dashboard, or funnel drop to the user's session. Turn a Mixpanel insight, board, or funnel drop into a session review. Follow a Segment or warehouse signal to the session that explains it. Go from a Snowplow event in the warehouse to the real session. ## Product and feedback Connect a Pendo guide, funnel, or path drop to the session behind it. Link an Appcues flow drop-off to what the user actually saw. Trace a Userpilot flow or adoption dip to the session. Pair a Sprig survey response with the session that prompted it. Open the session behind an Intercom conversation or ticket. ## Monitoring and errors Jump from a Sentry issue to the session at the moment it broke. Go from a Datadog RUM error or alert to the user's session. Follow a New Relic issue, error group, or rage click to the session. Pair a LogRocket error or rage-click signal with a Subtext review. Follow a trace from your OTLP backend into the session. ## Experimentation and flags Link a flag rollout regression to the affected sessions. Trace an experiment result or health warning to the session. Go from a Statsig metric drop or exposure to the session. ## Data and BI Query ClickHouse for friction, then open the matching session. Turn a Metabase dashboard signal into a session review. Follow warehouse-activated signals into the session. ## AI observability Jump from a failing LangSmith run or trace to the user's session. # Pendo and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/pendo Attach the Subtext session URL to Pendo, then jump from any Pendo signal — a dismissed guide, an NPS detractor, a path drop-off — straight into the visitor's real session. Pendo tells you *that* adoption moved: a guide was dismissed, a poll scored low, a path lost visitors. As product analytics with in-app guides, it can't show you what one specific visitor saw when they bailed. Subtext can. Attach the Subtext session URL to your Pendo visitor metadata and every Pendo signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that visitor's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Pendo detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and the Pendo agent snippet is installed on the page. No field setup is required — a value sent client-side via the snippet lands as agent metadata, which Pendo creates automatically the first time it receives it. Optionally give `subtext_url` a friendly display name under Pendo → Settings → Metadata. ## Attach the session URL Store the current Subtext session URL on the Pendo visitor so it travels with the visitor into every segment and report. It lands on the visitor's agent metadata, and the field needs no declaring first: Pendo creates the agent metadata the first time the snippet sends it. Attach the URL with `pendo.updateOptions` once the visitor is known. In React, put it in the same `useEffect` as `FS('setIdentity')`. If the visitor is already known at boot, you can set it in the initial `pendo.initialize` call instead. ```js pendo.updateOptions theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { pendo.updateOptions({ visitor: { subtext_url: subtextUrl } }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { pendo.updateOptions({ visitor: { id: user.id, subtext_url: subtextUrl } }) } }, [user]) ``` ```js pendo.initialize theme={null} pendo.initialize({ visitor: { id: user.id, subtext_url: subtextUrl } }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `pendo.updateOptions` whenever you re-identify the visitor; the metadata is frozen until the next update. And don't call `pendo.initialize` twice — use `pendo.updateOptions` after the first initialize. ## From signal to session However you first hear about a problem in Pendo — a low NPS score, a dismissed guide, a path that loses visitors — the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Pendo flagged the drop or the low score; the session shows whether the guide rendered over the right element, whether the step was confusing, or whether something was simply broken. Pendo notifies you of a detractor: NPS 2 with a comment like *"the new dashboard is confusing."* Open the responding visitor: **Visitors** → visitor details → **Metadata** → copy `subtext_url`. Then hand it to your agent: ```text theme={null} A Pendo NPS detractor scored us 2 and said "the new dashboard is confusing." Here's their session: Open it around their dashboard usage. What were they trying to do, where did they hesitate or get stuck, and is the confusion a real UX problem or a one-off? Ground their feedback in what actually happened on screen and point me to the moments. ``` Your Pendo guide engagement report shows an onboarding guide being dismissed far more than completed. Build a segment of visitors who dismissed the guide, open their visitor records, and copy `subtext_url` from each. Grab a few, then hand them to your agent: ```text theme={null} This Pendo onboarding guide is getting dismissed way more than completed. Here are sessions from visitors who dismissed it: Review them. When the guide appeared, did it render correctly over the right element, or was it mis-positioned / covering something / firing at a bad moment? Tell me why people are dismissing it — bad timing, bad targeting, or bad copy — with evidence per session. ``` A Pendo Paths or Funnels report shows visitors dropping at a specific step of a key workflow. Segment the dropped visitors and copy `subtext_url` from each visitor's metadata: ```text theme={null} Our Pendo funnel shows visitors dropping at the step. Here are sessions from visitors who dropped there: Walk each one to that step and tell me what stops them. Is it broken, slow, confusing, or are they just done? Find the common reason and show me the exact moment they give up. ``` For a dismissed guide or a shared drop-off, ask your agent to roll the findings into one proof document (`doc-create`) — a screenshot of the guide as each dismisser actually saw it, plus a single shared link. Paste that back into the Pendo guide or report notes so the engagement number carries its cause. ## For agents An autonomous agent can run the whole loop against Pendo directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. Pendo ships an official MCP server — remotely hosted, OAuth-authenticated, and it respects your existing Pendo permissions ([pendo.io/product/mcp](https://pendo.io/product/mcp/)). Use the MCP to confirm the metadata field and aggregate for hotspots; for deterministic single-visitor `subtext_url` reads, Pendo's REST API is exact. Aggregate paths, funnels, guide engagement, or NPS and poll responses to find drop-offs and dismissals. Over the MCP, use the query tools (`activityQuery`, with an App ID from `list_all_applications`, plus `searchEntities` to find pages and features, `guideMetrics` for guide engagement, and `npsScore` for NPS). Over REST, POST the Aggregation API with a pipeline `source` — `pollsSeen` / `pollEvents` for NPS and polls, guide-engagement or path/funnel aggregations for dismissals and drop-offs, and visitor / feature / page activity for low-adoption hotspots. ``` POST https://app.pendo.io/api/v1/aggregation # header: x-pendo-integration-key: # body: a pipeline with a `source` ``` Read `subtext_url` off the visitor's metadata. Confirm the field first with the MCP's `visitorMetadataSchema`, then read it deterministically per visitor over REST: ``` GET https://app.pendo.io/api/v1/visitor/{visitor_id} # header: x-pendo-integration-key: # → response.metadata.agent.subtext_url ``` `metadata` is grouped by origin (`agent`, `custom`, `salesforce`, ...): fields sent by the install snippet land under `metadata.agent`, while `custom` fields are added manually in Pendo or via the API — the snippet never writes them. For each URL, call `review-open(session_url=)` on the Subtext MCP → a Detect-vs-Diagnose summary: Pendo flagged the dismissal or the drop; the session shows whether the guide mis-positioned, mistimed, or covered the UI. `subtext_url` only round-trips if it was written as visitor metadata at capture time (see [Attach the session URL](#attach-the-session-url)). Pendo's published tool list varies by source — the authoritative list is the Pendo help center, not third-party catalogs. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # PostHog and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/posthog Attach the Subtext session URL to PostHog, then jump from any PostHog signal — a funnel drop, an exception, an alert — straight into the user's real session. PostHog tells you *that* a number moved: a conversion dropped, an event spiked, an exception appeared. It can't tell you *why* one specific person got stuck. Subtext can. Attach the Subtext session URL to your PostHog data and every PostHog signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. PostHog detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the PostHog JS SDK (`posthog-js`) is initialized. ## Attach the session URL Store the current Subtext session URL on your PostHog data so it travels with the signal. There are three places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the PostHog person with `posthog.identify`. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { posthog.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { posthog.identify(user.id, { subtext_url: subtextUrl }) } }, [user]) ``` ### On every event Register the URL as a super property and it rides along on every subsequent event automatically. The value is frozen at registration time; re-register it when the session or identity changes. ```js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { posthog.register({ subtext_url: subtextUrl }) } ``` ### On a specific event When the exact moment matters, pass the URL on a single `capture` call. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal events like errors, rage clicks, and conversion failures. ```js theme={null} posthog.capture('checkout_failed', { reason: error.message, subtext_url: FS('getSession', { format: 'url.now' }), }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-attach on re-identify. Super properties are frozen at set-time; re-register them. ## From signal to session However you first hear about a problem in PostHog, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Your subscribed PostHog insight emails you: "Signup → Activation funnel: conversion down 8% week-over-week." Open the funnel and click the drop-off step's bar (or the linked "dropped" count below the chart) to view the people who dropped at that step. Open a dropped person, go to the **Properties** tab, and copy `subtext_url`. Grab a few, then hand them to your agent: ```text theme={null} PostHog says our Signup → Activation funnel dropped 8% this week. Here are sessions from users who fell out at the activation step: Review them and find the common reason they didn't convert. Give me a Detect-vs-Diagnose read per session, then one synthesized hypothesis for the drop. Point to the exact moments. ``` PostHog Error Tracking surfaces a new exception group affecting real users. Open the issue, open a sample event, go to **Properties**, and copy `subtext_url` — it is deep-linked to the moment the event fired. ```text theme={null} PostHog Error Tracking flagged this exception on user . Session, deep-linked to the moment it fired: Open it at that timestamp. What was the user doing in the 30s before? Did the error block them, or did the app recover? Is it reproducible from that flow? ``` A PostHog alert fires: "`checkout_completed` is 30% below expected." From the alert, pivot to users who started but did not complete checkout in the window, open their profiles, and copy `subtext_url`. ```text theme={null} A PostHog alert says checkout_completed is 30% below normal. Here are sessions from users who started checkout but didn't finish in that window: Walk each session through the checkout flow. Where exactly do they stall, and is it the same place every time? Tell me whether it's a bug or a UX problem. ``` For a drop-off across several users, ask your agent to roll the findings into one proof document (`doc-create`) with a screenshot per session and a single shared link — then paste that back into the PostHog insight so the number carries its explanation. ## For agents An autonomous agent can run the whole loop against PostHog directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. PostHog ships an official MCP server at `https://mcp.posthog.com/mcp`, authenticated with OAuth or a personal API key; it routes automatically to your US or EU data region based on the account you authenticate with. Use `query-error-tracking-issues-list` for exception hotspots or `query-funnel-actors` for the users who dropped at a step. For anything else, `execute-sql` runs HogQL directly. Read `subtext_url` off the affected persons or events with `persons-retrieve`, or an `execute-sql` query over `persons` / `events`: ```sql theme={null} SELECT distinct_id, properties.subtext_url, timestamp FROM events WHERE properties.subtext_url IS NOT NULL ORDER BY timestamp DESC ``` For each URL, call `review-open(session_url=)` on the Subtext MCP. Event-level URLs are moment-precise, so the review opens exactly when the signal fired. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)). Event-level links are moment-precise; person-level links open at session start. Match your region (US vs EU) for the API host; the MCP endpoint is the same for both regions and routes to your data region automatically based on the account you sign in with. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Segment and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/segment Attach the Subtext session URL to Segment traits and events, then jump from any Segment signal — a warehouse funnel drop, a computed audience, a Protocols alert — straight into the user's real session. Segment is plumbing: it routes traits and events to your warehouse, BI tool, and engagement platform. It doesn't tell you *why* one person dropped or errored — the number lives downstream, in Looker or Engage, and it can't replay what the user actually saw. Subtext can. Attach the Subtext session URL to your Segment traits and events and it travels with every user and event into those downstream tools — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Your warehouse and audiences detect; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and Segment Analytics.js (`analytics.js` or `@segment/analytics-next`) is initialized. ## Attach the session URL Store the current Subtext session URL on your Segment data so it travels with every trait and event into your warehouse and downstream tools. There are two places to attach it, depending on how precise the link needs to be. ### On the user profile Attach the URL to the Segment user profile via `analytics.identify`. Call it wherever your app already identifies the user — on auth resolution, not at module top level. Segment accepts any trait key, so use `subtext_url`; the warehouse connector snake\_cases column names anyway, so it lands as `subtext_url` there. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { analytics.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { analytics.identify(user.id, { subtext_url: subtextUrl }) } }, [user]) ``` ### On every event Segment source middleware runs on every call, letting you attach the URL fresh per event. Because `url.now` carries a timestamp, the link deep-links to the moment each event fired. Register the middleware once at app initialization, before any `track` calls. ```js theme={null} analytics.addSourceMiddleware(({ payload, next }) => { if (payload.obj.type === 'track') { const url = FS('getSession', { format: 'url.now' }) if (url) payload.obj.properties = { ...payload.obj.properties, subtext_url: url } } next(payload) }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't switch the key mid-stream: use `subtext_url` across both `identify` and `track`, since lookups and filters are case-sensitive and a mismatched key won't be found. And don't register the middleware inside a component render — register it once at the analytics initialization point. The session URL changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so if your app calls `analytics.identify` on every auth state change, the user-level linkage stays current automatically; the source middleware reads the URL fresh on every event, so it never needs re-attaching. ## From signal to session Segment is plumbing, so you never hear about a problem *in* Segment — you hear about it in a downstream surface: a warehouse dashboard, a computed audience, a data-quality alert. However it reaches you, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. The data says this user dropped or errored; the session shows what they actually experienced. The analyst or growth PM reviewing the weekly funnel in Looker, Mode, or Hex sees the `checkout` funnel — built on Segment events in the warehouse — converting below trend. Query the event table for the affected users' sessions: ```sql theme={null} SELECT user_id, subtext_url, event, timestamp FROM segment..checkout_started WHERE subtext_url IS NOT NULL AND user_id IN () ORDER BY timestamp DESC LIMIT 20; ``` Grab a few, then hand them to your agent: ```text theme={null} Our warehouse funnel (built on Segment events) shows checkout conversion below trend. Here are session URLs for users who started but didn't complete: Review them and find the common failure point. Detect-vs-Diagnose: the data says they dropped — what does each session actually show at the drop step? One synthesized hypothesis at the end. ``` The lifecycle or CRM owner sees a user land in a computed audience like *Started checkout, no purchase in 24h* in Twilio Engage (or a connected tool), and wants to know *why* before triggering a win-back. Open the user's profile in Segment, go to **Traits**, and copy `subtext_url`. ```text theme={null} This user entered our "abandoned checkout" audience. Before I send a win-back, I want to know what actually happened. Session: Open it and tell me: did they abandon by choice, or did something break/confuse them at checkout? If it's a bug, that changes the message I send. Walk me through the relevant moments. ``` The data engineer who owns tracking quality gets a Segment Protocols violation — a key event firing with malformed or missing properties, suggesting a broken client. Find a recent offending event in the source debugger or warehouse; if it carries `subtext_url`, copy it. ```text theme={null} Segment Protocols flagged malformed `Checkout Started` events from the web client. Here's a session where one fired: Open it around that event. Is the client genuinely broken (bad state, JS error) or is the tracking just mis-wired? Show me the UI and console at that moment so I can tell a real bug from a schema problem. ``` For a funnel investigation across several users, ask your agent to consolidate the findings into one proof document (`doc-create`) — a screenshot per dropped user and a single shareable link — then drop it into the dashboard annotation, Engage profile note, or data-quality ticket so the next person sees the human story behind the number. And if the review shows the drop was a deliberate user choice rather than a bug, say so: that redirects effort toward messaging or pricing instead of engineering. ## For agents An autonomous agent can run the whole loop against Segment directly: discover the friction, extract the `subtext_url`, and hand each session to the Subtext MCP. There is **no official Segment CDP data MCP** — don't assume one exists. The only Segment-related MCP is the **Twilio MCP** (`mcp.twilio.com/docs`), a read-only documentation index whose `twilio__search` and `twilio__retrieve` tools return API specs and schemas; it helps you *find* the right Segment endpoint but can't read a trait or query an audience. The practical stance is to call Segment's REST and warehouse directly, optionally using the Twilio docs MCP to look up exact request shapes. Segment has no native funnel API — it's plumbing, not an analytics product. Compute drop-offs with warehouse SQL over the warehouse `tracks` tables: ```sql theme={null} -- step-to-step conversion to find the worst drop-off SELECT event, count(distinct user_id) AS users FROM segment..tracks WHERE timestamp > current_date - 7 GROUP BY event ORDER BY users DESC; ``` Or surface at-risk segments with computed and predictive traits via the Profile API (`?class=computed_trait`, `?class=audience`). Read `subtext_url` per user from the Profile API: ``` GET https://profiles.segment.com/v1/spaces//collections/users/profiles//traits?include=subtext_url # EU residency: https://profiles.euw1.segment.com/... # external_id = "user_id:abc123" or "anonymous_id:..." # Auth: HTTP Basic, Access Token as username, empty password (-u :) # → response.traits.subtext_url ``` `include=subtext_url` returns just that trait (default page size is 10 traits; `?limit=200` max). This is server-side only — no CORS. For event-level, moment-linked URLs, query the `subtext_url` column on the event-specific table (e.g. `segment..checkout_started`) instead — custom Track properties land as un-prefixed columns on `.` tables, not on `tracks`. For each URL, call `review-open(session_url=)` on the Subtext MCP, step through the drop, and return a Detect-vs-Diagnose read: the warehouse says they dropped, the session shows what they experienced. `subtext_url` only round-trips if it was attached as a user trait or event property at capture time (see [Attach the session URL](#attach-the-session-url)). Match your region for the API host (`profiles.segment.com` vs `profiles.euw1.segment.com`). Event-level links from the warehouse event tables are moment-precise; user-trait links open at session start. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Sentry and Subtext: From an Error to the Session Source: https://subtext.fullstory.com/docs/integrations/sentry Attach the Subtext session URL to Sentry as a tag, then jump from any error or performance issue straight into the user's real session. Sentry tells you *that* an exception was thrown: an issue spikes, a regression appears, a transaction slows. It can't tell you *whether* the person was actually blocked or what they saw when it fired. Subtext can. Attach the Subtext session URL to your Sentry events as a tag and every issue becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Sentry detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the Sentry JavaScript SDK (`@sentry/browser` or a framework-specific package) is initialized. ## Attach the session URL Store the current Subtext session URL on your Sentry events as a tag so it travels with every error. Tags are indexable and searchable in the Sentry UI, and there are two ways to set one. ### As a global tag Set the URL as a Sentry tag once, after identification. It rides on every subsequent error event and shows up wherever you filter issues. Session URL values fit within Sentry's 200-character tag limit. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { Sentry.setTag('subtext_url', subtextUrl) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) Sentry.setUser({ id: user.id, email: user.email }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { Sentry.setTag('subtext_url', subtextUrl) } }, [user]) ``` ### Per error, with beforeSend `beforeSend` runs on every captured event and reads the URL fresh, so each error gets a link to the exact moment it occurred rather than a frozen session-start link. `beforeSendTransaction` does the same for performance events. ```js theme={null} Sentry.init({ dsn: '', beforeSend(event) { const url = FS('getSession', { format: 'url.now' }) if (url) event.tags = { ...event.tags, subtext_url: url } return event }, beforeSendTransaction(event) { const url = FS('getSession', { format: 'url.now' }) if (url) event.tags = { ...event.tags, subtext_url: url } return event }, }) ``` Reach for `beforeSend` when moment-level precision on errors matters more than simplicity. The two patterns can coexist — `beforeSend` overwrites the global tag value for each specific event. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't put the URL in `event.extra`; use `event.tags` so it stays searchable in the Sentry UI. The session URL changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `Sentry.setTag` whenever you re-identify. `beforeSend` reads the URL fresh on every event, so it never needs re-attaching. ## From signal to session However you first hear about a problem in Sentry — a paged alert, a "New Issue" email, an assigned ticket — the path is the same: get to the `subtext_url` on the event, then hand it to your agent. Sentry tells you an exception was *thrown*; the session tells you whether the user was actually *blocked*, what they saw, and the exact sequence that triggered it. That gap is the Detect-vs-Diagnose read, and the output is a structured summary you can paste back into the Sentry issue. A Sentry "New Issue" or "Regression" email lands in your inbox: *`TypeError: cannot read properties of undefined (reading 'total')` — CheckoutForm.tsx*. Click through to the issue from the email, open the latest event, go to the **Tags** section, and copy the `subtext_url` value. Then hand it to your agent: ```text theme={null} Sentry just emailed me a regression: TypeError in CheckoutForm. Here's the session from the moment it fired: Open it and give me a Detect-vs-Diagnose read. Sentry says the exception was thrown — did it actually break the user, or did the page recover? Walk the 30s before the error, tell me what the user was doing, what the UI looked like when it fired, and whether this reproduces from that flow. End with a one-paragraph summary I can drop into the Sentry issue. ``` The Sentry Slack integration posts "Issue spiking — 142 events in 10 min, first seen in release `web@2.8.0`." Click the Slack alert; it deep-links to the issue. Because a spike is many sessions, grab `subtext_url` from three or four different recent events. ```text theme={null} A Sentry issue is spiking right after we shipped web@2.8.0. Here are subtext_urls from several affected sessions: Review each one and find the common thread. Is it the same flow, the same browser, the same input? Which sessions show real user impact vs. a swallowed error? Give me a single root-cause hypothesis and tell me whether this is a rollback or a hotfix. ``` Your Sentry inbox has a stack of issues assigned to you for the shift. In the Issues view, filter `has:subtext_url` to surface only the issues that have a session attached — those are the ones you can actually *see*. Triage those first and copy the tag from each. Run the per-issue prompt above, and for anything where the session shows no real impact, downgrade it: ```text theme={null} Here's a Sentry issue assigned to me with a session attached: Give me a fast Detect-vs-Diagnose read: did this actually block the user, or is it a swallowed / already-recovered error? If the session shows no real impact, say so plainly so I can downgrade it. ``` After the review, paste the agent's structured summary back into the Sentry issue as a comment so the next person inherits the diagnosis, not just the stack trace. For a spike across several sessions, ask your agent to roll the findings into one proof document (`doc-create`) with a screenshot per session and a single shared link, then drop that link into the issue. ## For agents An autonomous agent can run the whole loop against Sentry directly: discover the worst issues, extract the `subtext_url`, and hand each session to the Subtext MCP. Sentry ships a first-party MCP server at `https://mcp.sentry.dev/mcp` (Streamable HTTP, with SSE fallback); for self-hosted Sentry, run it locally over stdio with `npx @sentry/mcp-server@latest`. The hosted endpoint authenticates with OAuth through your Sentry org; local uses a User Auth Token with the scopes Sentry's MCP docs require: `org:read`, `project:read`, `project:write`, `team:read`, `team:write`, and `event:write`. Use `search_issues` to rank hotspots — pass a query and a sort, e.g. `search_issues(query="is:unresolved", sort="freq")`. Drill into an issue with `get_issue_details`, `search_issue_events`, `search_events`, or `get_event_stacktrace`. Over REST, the org-level Issues endpoint does the same (the project-level one is deprecated): ``` GET /api/0/organizations/{org}/issues/?query=is:unresolved&sort=freq&statsPeriod=24h&limit=100 # sort=freq → by event volume; sort=user → by # users affected # Authorization: Bearer ``` Append `has:subtext_url` to the query to keep only issues with a session attached; its inverse `!has:subtext_url` surfaces capture gaps. `subtext_url` is stored as an event tag. Read the aggregate of values seen on an issue with `get_issue_tag_values(tagKey="subtext_url")`. Over REST: ``` # Per event (moment-precise) GET /api/0/projects/{org}/{project}/events/{event_id}/ # response.tags is an array of {key, value}; find key === "subtext_url" → .value # Aggregate (all values seen on an issue) GET /api/0/organizations/{org}/issues/{issue_id}/tags/subtext_url/ # response.topValues[N].value ``` For each URL, call `review-open(session_url=)` on the Subtext MCP, then read the event map and step to the error moment for a Detect-vs-Diagnose read. When triaging a spike, pull `subtext_url` from several affected events and review them together to find the common trigger. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)). `beforeSend` produces moment-precise links; the global tag opens at session start. Sentry caps tag values at 200 characters — session URLs fit, but verify if you ever see truncation. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Snowplow and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/snowplow Attach the Subtext session URL to every Snowplow event as a custom entity, then jump from any modeled behavioral signal — a funnel drop, a failed-events spike, an odd custom event — straight into the user's real session. Snowplow tells you *that* something moved in your behavioral data: a step-completion rate slips below trend, an event fires at an implausible rate, a batch of events fails schema validation. It can't show you what one specific person saw. Subtext can. Attach the Subtext session URL to every Snowplow event as a custom entity and it flows through the pipeline into your warehouse, so any event you model there deep-links back to the matching session — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Snowplow detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and a Snowplow web tracker is running — either the tag (`window.snowplow(...)`) or the npm `@snowplow/browser-tracker`. The examples query ClickHouse — which Snowplow feeds via its Snowbridge stream forwarder or via the Lake Loader's Iceberg/Delta output, not a dedicated loader — but any of Snowplow's supported loader targets (Snowflake, Databricks, BigQuery, Redshift) works the same way; only the entity-column syntax differs. ## Attach the session URL Snowplow attaches extra data to events as **entities** (custom contexts), each validated against a schema. The cleanest way to add one value to *every* event is a **global context** — define it once and the tracker sends it with every subsequent event, no per-call wiring. ### Define the entity schema Entities are schema-validated, so first add a self-describing schema to your Iglu registry. A minimal one holds a single URL: ```json theme={null} { "$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#", "self": { "vendor": "com.yourco", "name": "subtext_session", "format": "jsonschema", "version": "1-0-0" }, "type": "object", "properties": { "url": { "type": "string", "maxLength": 4096 } }, "required": ["url"], "additionalProperties": false } ``` ### Attach it as a dynamic global context The session URL changes across sessions and carries a per-moment timestamp, so use a **context generator** (a function) rather than a static object. The tracker runs it for every event, reading the URL fresh, and skips the entity when there is no session yet by returning `undefined`. Register it once, after the tracker is initialized — every `trackPageView`, `trackSelfDescribingEvent`, and built-in event fired afterward carries the entity. ```js @snowplow/browser-tracker theme={null} import { addGlobalContexts } from '@snowplow/browser-tracker' addGlobalContexts([ () => { const url = FS('getSession', { format: 'url.now' }) if (!url) return undefined // no session yet — attach nothing return { schema: 'iglu:com.yourco/subtext_session/jsonschema/1-0-0', data: { url }, } }, ]) ``` ```js Tag (window.snowplow) theme={null} window.snowplow('addGlobalContexts', [ function () { var url = FS('getSession', { format: 'url.now' }) if (!url) return undefined return { schema: 'iglu:com.yourco/subtext_session/jsonschema/1-0-0', data: { url: url } } }, ]) ``` ### Where it lands in the warehouse Snowplow shreds each entity into its own column or table named from the schema — for the schema above, a column like `contexts_com_yourco_subtext_session_1`, an array whose first element holds `{ "url": "..." }`. Query the URL out of that path (ClickHouse example): ```sql theme={null} SELECT user_id, contexts_com_yourco_subtext_session_1[1].url AS subtext_url, event_name, collector_tstamp FROM atomic.events WHERE event_name = 'checkout_error' AND length(contexts_com_yourco_subtext_session_1) > 0 ORDER BY collector_tstamp DESC LIMIT 20; ``` The exact column path depends on your loader; check your `atomic` schema for the shredded entity name. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started; the generator runs per event, which is exactly when a session exists. Don't attach the URL as a *static* global context object, which would freeze the value at registration time — use the generator so each event gets the current, moment-linked URL. Don't skip the schema step — an entity that fails validation lands in your failed events stream, not your warehouse. And don't put the signed URL anywhere untrusted readers can reach it; it grants replay access. ## From signal to session However you first hear about a problem in Snowplow — a modeled behavioral table, a Failed Events alert, a data-quality check — the path is the same: get to the `subtext_url` on the affected rows, then hand it to your agent for a Detect-vs-Diagnose read. The atomic events say a user errored or dropped; the session shows what they actually experienced. An analytics engineer or PM reviewing a dbt-modeled funnel built on Snowplow atomic events notices a step-completion rate falling below trend for a specific event. Query the modeled table (or `atomic.events`) for the affected users' sessions and read `subtext_url` off the shredded entity column: ```sql theme={null} SELECT user_id, contexts_com_yourco_subtext_session_1[1].url AS subtext_url, collector_tstamp FROM atomic.events WHERE event_name = 'checkout_step_completed' AND length(contexts_com_yourco_subtext_session_1) > 0 AND user_id IN () ORDER BY collector_tstamp DESC LIMIT 20; ``` Grab a few, then hand them to your agent: ```text theme={null} Our Snowplow-modeled checkout funnel shows a step converting below trend. Here are session URLs for users who dropped at that step: Review them and find the common failure point. Detect-vs-Diagnose: the data says they dropped — what does each session actually show at that step? One synthesized hypothesis at the end. ``` The data engineer who owns tracking quality sees Snowplow's Failed Events stream spike — events failing schema validation, which usually means a broken client, not just bad instrumentation. Successful events from the same users still carry the entity, so find a recent good event for an affected user and read its `subtext_url`. ```text theme={null} Snowplow Failed Events spiked for `checkout_step_completed` from the web client. Here's a session from an affected user around that time: Open it and tell me whether the client is genuinely broken (bad state, JS error) or the payload is just mis-shaped. Show me the UI and console at that moment so I can tell a real bug from a schema drift. ``` A product analyst investigating a custom event finds a self-describing event firing at an implausible rate or with odd properties. Filter `atomic.events` to that event schema and pull the session link. ```text theme={null} This custom event is firing far more than expected. Here's a session where it happened: Open it around that event. Is the user really doing this, or is the client double-firing? Walk me through the relevant moments. ``` For a funnel investigation across several dropped users, ask your agent to consolidate the findings into one proof document (`doc-create`) — a screenshot per session and a single shareable link — then drop it into the model's documentation or the data-quality ticket so the next person sees the human story behind the number. ## For agents An autonomous agent can run the whole loop, but not against Snowplow directly. Snowplow is a pipeline, not a query product: Snowplow's official MCP server works against the Snowplow Console — tracking plans, pipeline health, and failed-event investigation — not your event data, and querying the collector or enrichment stack is not the path. Snowplow's value is that it lands clean, modeled events in your **warehouse**, so the agent story runs through the warehouse's MCP. * If that warehouse is ClickHouse, use the official **`mcp-clickhouse`** server (`list_databases`, `list_tables`, `run_query`, read-only by default). * For Snowflake, BigQuery, or Redshift, use that warehouse's own MCP or SQL API. The query shape is identical; only the entity-column syntax differs. The shredded entity column returns both the friction and the link on the same rows, so a single query does discovery and extraction together: ```sql theme={null} -- worst-converting checkout step in the last week, with a session per dropped user SELECT user_id, contexts_com_yourco_subtext_session_1[1].url AS subtext_url, collector_tstamp FROM atomic.events WHERE event_name = 'checkout_step_completed' AND collector_tstamp > now() - INTERVAL 7 DAY AND length(contexts_com_yourco_subtext_session_1) > 0 ORDER BY collector_tstamp DESC LIMIT 25; ``` For each URL, call `review-open(session_url=)` on the Subtext MCP and get a Detect-vs-Diagnose read: the model says they dropped versus what the session actually shows. The entity only round-trips if the tracker attached it at capture (see [Attach the session URL](#attach-the-session-url)); events fired before you registered the global context carry an empty array, so filter `length(...) > 0`. The shredded column name is derived from your schema's vendor, name, and version — confirm it against your `atomic` schema before hard-coding it. Keep the warehouse MCP read-only; a review agent never needs write access. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Sprig and Subtext: From a Survey Response to the Session Source: https://subtext.fullstory.com/docs/integrations/sprig Attach the Subtext session URL to your Sprig survey responses, then jump from any low score or open-text comment straight into the user's real session. Sprig tells you *what* a user said: a low score, a detractor comment, a confusing open-text verbatim. It can't tell you *what actually happened* on their screen when they said it. Subtext can. Attach the Subtext session URL to your Sprig visitor attributes and every survey response carries a deep link back to the real session — your agent reads the `subtext_url`, opens that person's session, and walks the decisive moments with screenshots, the component tree, network, and console. Sprig detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and the Sprig browser SDK is initialized (via the Sprig HTML snippet, or via `@sprig-technologies/sprig-browser` using the equivalent method-call syntax, `Sprig.setAttributes(...)` / `Sprig.setUserId(...)`). ## Attach the session URL Attach the current Subtext session URL to the Sprig visitor with `setAttributes`. It rides along on the visitor and is stamped onto any survey responses they submit, so each response carries a deep link back to what the user was doing. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { Sprig('setAttributes', { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { Sprig('setUserId', user.id) Sprig('setAttributes', { subtext_url: subtextUrl }) } }, [user]) ``` Set the attribute before a survey is likely to trigger so an in-progress response captures it. Re-setting it later updates the value for subsequent responses. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `Sprig('setAttributes', …)` whenever you re-identify the user. The attribute is frozen until the next call, and responses use whatever value was set when they were submitted. Keep the URL as an attribute — don't put it in the survey question text, so it stays queryable across responses. ## From signal to session However you first hear about it in Sprig — a detractor notification, a vague verbatim, a recurring theme at study wrap-up — the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. A Sprig response is what the user *said*; the `subtext_url` stamped on it is what they *did*. Sprig notifies you of a low-score response with a comment like *"couldn't find where to export."* Open the study, go to **Responses**, open the response, go to **Attributes**, and copy `subtext_url`. Then hand it to your agent: ```text theme={null} A Sprig respondent scored us low and wrote: "couldn't find where to export." Here's their session: Open it and ground the feedback in reality. Did they actually go looking for export? Where did they look, what did they miss, and is the control genuinely hard to find or were they looking in the wrong place? Point me to the exact moments. Detect-vs-Diagnose: the survey says X — does the session confirm it? ``` A response says something ambiguous — *"it just didn't work"* — and the words alone are useless. Open that response, go to **Attributes**, and copy `subtext_url`. ```text theme={null} This Sprig comment is too vague to act on: "". Here's the respondent's session: Open it and tell me what they're actually referring to. What were they doing when it "didn't work," what broke or confused them, and is it reproducible? Translate the vague feedback into a concrete, located problem. ``` You're closing out a study and a recurring complaint shows up across several responses. Filter responses by the low score or theme and copy `subtext_url` from each (or export the responses — `subtext_url` is a column). ```text theme={null} At the end of this Sprig study, several people complained about . Here are their sessions: Review them together and find the shared UX pattern behind the complaint. Is everyone hitting the same moment of friction, or different things they're describing similarly? Give me the one concrete problem to fix, with the moments that prove it across sessions. ``` For a study wrap-up, ask your agent to assemble a proof document (`doc-create`) with a screenshot of the friction moment per respondent, then attach it to your research synthesis — the verbatim now carries the behavior that explains it. The whole point is closing the say-do gap: a low score with a session attached shows not just that someone was unhappy, but exactly where and why, and whether it reproduces. ## For agents An autonomous agent can run the whole loop against Sprig directly: find the low-score or themed feedback, extract the stored `subtext_url`, and hand each session to the Subtext MCP. Sprig ships an official MCP server at `https://mcp.sprig.com/mcp`, authenticated with OAuth 2.0 (an admin enables it at **Settings → Agents → Sprig MCP**; members connect their own accounts, scoped to workspace permissions). It exposes three tools — Retrieve Surveys, Retrieve Responses, and Retrieve Themes — enough for the discovery loop below; use the Data Export API when you need bulk extraction. Start with the Sprig MCP: **Retrieve Surveys** lists the studies in the workspace, **Retrieve Responses** fetches a study's responses, and **Retrieve Themes** returns Sprig's AI-generated themes — its open-text analysis auto-clusters free-text feedback — with their associated responses. Filter by **score** (low CSAT/NPS) and theme to isolate the complaints worth reviewing. For bulk extraction, fall back to the **Data Export API** (`Authorization: Bearer `) against the REST base `https://api.sprig.com`. (The **Public API v2**, `Authorization: API-Key `, imports People, Events, and Attributes — and also reads them back: `GET /v2/users/{userId}` returns a visitor's attributes and events.) `subtext_url` is a respondent attribute (imported via the Public API's People/Attributes) and appears alongside each response in the Data Export. You don't need a separate lookup to get it: pass `with_snapshots=true` on the Data Export request and each response includes a `visitorSnapshot` with the visitor's attributes (including `subtext_url`) as of survey delivery. Alternatively, for identified visitors, take the response's `externalUserId` and read attributes directly with `GET https://api.sprig.com/v2/users/{userId}` (`Authorization: API-Key `) — note this returns *current* attributes (the snapshot preserves the value at survey time) and only works for visitors with user IDs; `externalUserId` is null for anonymous respondents. For each URL, call `review-open(session_url=)` on the Subtext MCP. Each review grounds the feedback in what actually happened — a Detect-vs-Diagnose read of what the respondent said versus what the session shows they did. For a theme, review several respondents' sessions together to find the shared pattern. `subtext_url` only round-trips if it was stamped onto the response as a visitor attribute at capture time (see [Attach the session URL](#attach-the-session-url)). ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Statsig and Subtext: From a Signal to the Session Source: https://subtext.fullstory.com/docs/integrations/statsig Attach the Subtext session URL to Statsig, then jump from any Statsig signal — a tripped guardrail, a red scorecard, a suspicious exposure — straight into the exposed user's real session. Statsig tells you *that* a variant moved a metric: a scorecard turned red, a guardrail tripped, a conversion dropped in the treatment. It can't tell you *why* one exposed person got stuck. Subtext can. Attach the Subtext session URL to your Statsig user object and every Statsig signal becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Statsig detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and the Statsig JS client (`@statsig/js-client`) is initialized. ## Attach the session URL Store the current Subtext session URL on your Statsig user object so it travels with the signal. There are two places to attach it, depending on how precise the link needs to be. ### On the user object Attach the URL to the Statsig user's `custom` field via `updateUserAsync`. Custom fields ride along on every subsequent exposure and `logEvent` call, so they show up in the logs that back your experiments. Call it wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { await client.updateUserAsync({ ...client.getContext().user, custom: { ...client.getContext().user.custom, subtext_url: subtextUrl }, }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { client.updateUserAsync({ userID: user.id, custom: { subtext_url: subtextUrl }, }) } }, [user]) ``` ### On a specific event When the exact moment matters, pass the URL directly on a single `logEvent` call. `url.now` carries a timestamp, so the link opens the replay at that instant — ideal for high-signal events like errors and conversion failures. ```js theme={null} client.logEvent({ eventName: 'checkout_failed', value: error.message, metadata: { subtext_url: FS('getSession', { format: 'url.now' }) }, }) ``` Don't read `FS('getSession')` at module top level — it returns `null` until the session has started, and don't call `updateUserAsync` before `client.initializeAsync` has resolved. When spreading into `updateUserAsync`, keep the rest of the user object (and existing `custom`) so you don't wipe targeting attributes. The session URL changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `updateUserAsync` whenever you re-identify — the `custom` field is frozen at set-time. In event `metadata`, don't use dotted keys (`subtext.url`): Statsig parses `.` as a nested path and can null the value. Store `subtext_url`. ## From signal to session However you first hear about a problem in Statsig, the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. The scorecard says the variant regressed; the session shows whether the new feature rendered correctly, errored, or simply confused people. Statsig posts to Slack: "⚠️ Guardrail `checkout_error_rate` triggered on experiment `new-cart-v2`, treatment group." Open the experiment and drill into the affected treatment users via Pulse / the Users tab. Inspect a recent exposure for one of them and copy `subtext_url` from the `custom` fields. Grab a few, then hand them to your agent: ```text theme={null} Statsig tripped a guardrail on experiment new-cart-v2 (treatment). Here are sessions from users who were exposed to the treatment and hit trouble: Review them with a Detect-vs-Diagnose lens. The metric says treatment is worse — what does the variant actually do on screen for these users? Did the new cart render correctly, throw an error, or confuse them? One root-cause hypothesis and whether we should ship, hold, or roll back. ``` In the weekly experiment review, a variant's scorecard is red on a key metric and someone asks "but why?" In the Statsig Console, open the **Users** tab, enter a `userID` from the regressed cohort, and read `custom.subtext_url` off the most recent exposure. ```text theme={null} We're reviewing experiment . The scorecard regressed on . Here's a session from a user in that variant: Open it and tell me what the variant experience was actually like for this person. Is the feature behaving as designed? Any errors or broken UI that would explain the metric? I need a concrete "here's why" for the readout, not a guess. ``` You spot one user in the Events Explorer who got the treatment and had a clearly bad outcome. Open that log line and copy `subtext_url` from the user `custom` fields or the event metadata. ```text theme={null} One user in the treatment of had a bad outcome. Session: Walk me through what they saw in the variant. Did my feature render and behave correctly for them? Find the exact moment it went wrong and show me the UI + console there. ``` For a regression spanning several exposed users, ask your agent to assemble one proof document (`doc-create`) with a screenshot per exposure and a single shared link — then paste that back into the experiment's notes or the readout deck so the scorecard number carries its explanation. ## For agents An autonomous agent can run the whole loop against Statsig: discover the regressed variant, extract the `subtext_url`, and hand each session to the Subtext MCP. Statsig ships an official MCP server at `https://api.statsig.com/v1/mcp` (remote, HTTP), authenticated with a `statsig-api-key` header (a Console API key — read keys get read tools) or OAuth. Its tools front the Console API (experiments, gates, dynamic configs, layers, metrics, segments, autotunes), for example `Get_List_of_Experiments` and `Get_Experiment_Details_by_ID`. Docs: `docs.statsig.com/integrations/mcp`. ```bash theme={null} claude mcp add --transport http statsig https://api.statsig.com/v1/mcp --header "statsig-api-key: " ``` For this workflow the MCP is discovery-only: **no MCP tool returns exposure records or the user `custom` fields where `subtext_url` is stored**, and no documented Console-API endpoint returns a single exposure record by ID with its custom field — that value lives in the warehouse, not the Console API. Extraction is warehouse- or webhook-based (see step 2); the warehouse route requires Statsig's Enterprise tier — non-Enterprise projects must use the Event Webhook. Use the MCP tools (`Get_List_of_Experiments`, `Get_Experiment_Details_by_ID`) or the Console API directly — base `https://statsigapi.net/console/v1`, header `STATSIG-API-KEY`, version `20240601`: ``` GET /console/v1/experiments # list experiments + status GET /console/v1/experiments/{id} # scores, config GET /console/v1/gates/{id}/rules/{ruleID}/pulse_results # per-metric directionality, % change, CI deltas, means, p-values → the regressed metric ``` Near-real-time affected-user and event signals come from the **Event Webhook**, which forwards exposure, gate, and experiment events to your endpoint. Read `subtext_url` from the warehouse exposures table (best fit) — e.g. `experimentation.statsig.exposures`. This table only exists with warehouse access to exposures, which is Enterprise-tier on Statsig: Data Warehouse Exports are Enterprise-only, and Warehouse Native is likewise part of the Enterprise tier. On Developer or Pro plans, capture `subtext_url` via the Event Webhook instead. The `user_dimensions` column is JSON of the user's attributes at first exposure: ```sql Databricks theme={null} SELECT unit_id, experiment_group, user_dimensions:subtext_url AS subtext_url FROM experimentation.statsig.exposures WHERE name = '' AND user_dimensions:subtext_url IS NOT NULL; ``` The JSON-extraction syntax varies by warehouse — e.g. `JSON_VALUE(user_dimensions, '$.subtext_url')` on BigQuery, `PARSE_JSON(user_dimensions):subtext_url` on Snowflake, `JSON_EXTRACT_PATH_TEXT(user_dimensions, 'subtext_url')` on Redshift. If you logged `subtext_url` on a custom event instead, it lands in that event's `metadata`. For each URL, call `review-open(session_url=)` on the Subtext MCP. Event-level URLs are moment-precise, so the review opens exactly when the signal fired. `subtext_url` only round-trips if it was emitted into the exposure stream (as a user attribute) or onto a custom event at instrumentation time (see [Attach the session URL](#attach-the-session-url)). Event-level links are moment-precise; user- and exposure-level links open at session start. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Userpilot and Subtext: From a Flow Drop to the Session Source: https://subtext.fullstory.com/docs/integrations/userpilot Attach the Subtext session URL to Userpilot, then jump from any onboarding drop or flow-step leak straight into the user's real session. Userpilot tells you *that* a user fell out of a flow or stalled in onboarding. It can't show you *what* they saw when they left. Subtext can. Attach the Subtext session URL to your Userpilot users and every drop becomes a jumping-off point — your agent reads the `subtext_url`, opens that person's real session, and walks the decisive moments with screenshots, the component tree, network, and console. Userpilot detects; Subtext diagnoses. This guide assumes the [Subtext capture snippet](/docs/install/overview) is installed and capturing sessions, and the Userpilot SDK (`userpilot`) is initialized. ## Attach the session URL Store the current Subtext session URL as a Userpilot user property so it rides along with the user into every flow, segment, and analytics view. Attach it with `userpilot.identify`, wherever your app already identifies the user — on auth resolution, not at module top level. ```js analytics.js theme={null} const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { userpilot.identify(user.id, { subtext_url: subtextUrl }) } ``` ```tsx React theme={null} useEffect(() => { if (!user) return FS('setIdentity', { uid: user.id, properties: { email: user.email } }) const subtextUrl = FS('getSession', { format: 'url.now' }) if (subtextUrl) { userpilot.identify(user.id, { email: user.email, subtext_url: subtextUrl, }) } }, [user]) ``` Call `userpilot.reload()` on route changes as usual; identified properties persist across reloads within the session. Don't read `FS('getSession')` at module top level — it returns `null` until the session has started. Don't call `userpilot.identify` before the SDK is initialized with your app token, and don't identify anonymous users with a throwaway id — attach the URL once the user is known so it reconciles to the right profile. The session URL also changes on a new session and when `FS('setIdentity')` is called with a different `uid`, so re-call `userpilot.identify` on every re-identify; the property stays frozen until the next identify. ## From signal to session However you first hear about a leak in Userpilot — an activation drop, a churn-risk flag, or a single flow step bleeding users — the path is the same: get to the `subtext_url`, then hand it to your agent for a Detect-vs-Diagnose read. Your Userpilot activation dashboard shows new users completing onboarding at a lower rate than usual. Build a segment of users who didn't complete onboarding, open their user records, go to the **Properties** tab, and copy `subtext_url`. Grab several, then hand them to your agent: ```text theme={null} Userpilot shows our onboarding completion rate dropping. Here are sessions from users who didn't finish: Review them and find where activation leaks. At which step do they stall, did each step render correctly, and is it broken / confusing / too long? Detect-vs-Diagnose: the data says they dropped — what does the session show caused it? One synthesized hypothesis + the moments. ``` A Userpilot segment surfaces an account or user flagged as low-engagement or churn-risk after a rough onboarding. Open the flagged user, go to the **Properties** tab, and copy `subtext_url`. ```text theme={null} Userpilot flagged this user as churn-risk after a weak onboarding. Session: Open it and tell me what their early experience was actually like — where they struggled, what they never discovered, and whether a bug or confusion soured them. I want to know if this is salvageable with a nudge or if the product failed them. ``` Userpilot flow analytics show a single step with a large drop. Segment the users who dropped at that step and copy `subtext_url` from each. ```text theme={null} This Userpilot flow loses a lot of users at the step. Here are sessions from users who dropped there: Walk each one to that step. When it appeared, did it render correctly and target the right element, or was it mis-positioned / mistimed / unclear? Tell me the common reason they bail, with evidence. ``` For a flow redesign, ask your agent to capture a proof document (`doc-create`) showing the step as the droppers saw it, then paste it into your Userpilot flow notes so the completion number carries its cause. A "step mis-renders or mistargets" verdict is the high-leverage find: invisible in the completion rate, obvious in the session, usually a quick fix. ## For agents An autonomous agent can run the same loop against Userpilot, with one honest caveat. Userpilot's real-time HTTP API is write-only — `identify` and `track` on `analytex.userpilot.io` — so there is no per-user GET to fetch a single visitor's attributes on demand. But Userpilot also documents a Bulk Data Export API (`POST appex.userpilot.io/api/v1/analytics/exports`, token auth) that exports raw events — including `identify_user` events carrying custom metadata like `subtext_url` — as JSON/CSV export jobs. You write `subtext_url` in via identify; reading it back over HTTP means an asynchronous bulk export, not a point lookup. Userpilot does ship an official MCP server (`userpilot.com/ai/mcp-server/`), but its endpoint, transport, auth model, and tool names aren't publicly documented, and whether it can read an individual visitor's custom attribute is unconfirmed. Confirm those before you depend on the round-trip, and for reliable extraction store `subtext_url` somewhere readable too — your warehouse, or another tool's user property. Use the Userpilot MCP server to surface the friction: adoption and retention drops, low-completion flows, NPS detractors, and survey sentiment. The real-time HTTP API cannot query friction data on demand, but Userpilot's Bulk Data Export API (Enterprise plan, or an add-on to Growth) can deliver it as async export jobs — raw JSON/CSV events including flow, checklist, survey, and NPS `interaction` events. Without that plan, fall back to a warehouse or reverse-ETL export you can query directly. There is no per-user read API. Get `subtext_url` from an MCP attribute tool if one exists (verify first), from an analytics or warehouse export where Userpilot data lands, or from another store that captured it at the same moment. For each URL, call `review-open(session_url=)` on the Subtext MCP, then walk the flow step where the user dropped for a Detect-vs-Diagnose read. `subtext_url` only round-trips if it was attached at capture time (see [Attach the session URL](#attach-the-session-url)). Because Userpilot has no per-user attribute read — only asynchronous bulk exports (Enterprise plan, or a Growth add-on) — plan a readable secondary store from the start; the MCP discovery surface and the export API are more dependable than any per-user attribute read. ## Related * [Session Review overview](/docs/session-review/overview) — what your agent does once a session is open. * [Install the capture snippet](/docs/install/overview) — required before any session URL exists to attach. # Subtext: Session Replay and Devtools Built for AI Agents Source: https://subtext.fullstory.com/docs/introduction Subtext gives AI coding agents visibility into your running application — session replay, a hosted browser, and a semantic map of your UI. AI coding agents are good at reading code. They can browse your file tree, trace a call stack, and reason about what your application is supposed to do. What they can't do — until now — is see what your application actually does when it runs. Subtext closes that gap by connecting your agent to the live signals that have always existed in your app: session recordings, browser devtools, network traffic, and a structured map of your UI. ## The problem When a bug gets filed, a design drifts, or a flow breaks in production, a human developer opens a session replay, scrubs to the moment it went wrong, and figures it out. Your agent can't do that. It has no way to open a recording, inspect a component tree, watch a network request fail, or compare what the UI looked like before and after a change. It works from static context alone — which means it guesses where it should know. ## The solution Subtext gives your agent the same visibility a developer has. Install the capture snippet once, connect your agent through the MCP server, and your agent can open real sessions, step through events, take snapshots of your running UI, and check its own work against what actually rendered. It is not a new agent framework or a replacement for your existing tools — it is the layer that makes the tools you already use aware of your running application. ## Relationship to Fullstory Subtext is a child brand of Fullstory. The session capture infrastructure — the snippet, the edge recording pipeline, the event stream — is Fullstory's. Subtext wraps that infrastructure in an agent-native interface: MCP tools, semantic snapshots, and structured workflows your agent can reason about without human translation. ## Core capabilities Replay real session recordings from your users. Your agent steps through the event timeline, captures UI snapshots at any point, and compares states across timestamps — no human scrubbing required. Form inputs are masked out of the box. Beyond that, your agent runs a PII scanning loop — flagging elements that carry sensitive data, proposing masking rules, and surfacing them for your approval before they ever leave the browser. An open-source semantic map of your UI, stored as YAML in `.sightmap/`. It maps CSS selectors to component names, source file paths, and memory notes. Every snapshot your agent takes is enriched with this context automatically — components are named, not anonymous HTML. Slash commands that teach your agent structured workflows. `/subtext:subtext-search` finds sessions by behavior. `/subtext:subtext-review` walks your agent through reading the app map, zooming to the moments that matter, and explaining what happened. `/subtext:subtext-session` catalogs every session replay tool and its usage patterns. `/subtext:subtext-shared` establishes the MCP conventions and security rules that all other skills build on. ## Verify beta Subtext also includes Verify — a beta set of tools that adds a cloud-hosted browser, artifact storage, proof documents, and the full Sightmap toolchain to your agent's reach. With Verify, your agent opens a live browser, interacts with your application, inspects the network, and records evidence of its work. See the [Verify overview](/docs/verify/overview) for details. ## Get started The fastest way to set up Subtext is the setup wizard. Run it in your project directory and it detects your agent, wires up the capture snippet, configures the MCP server, and installs skills automatically: ```bash theme={null} npx @subtextdev/subtext-wizard ``` Ready to go deeper? Head to the [quickstart](/docs/quickstart) for a step-by-step walkthrough, or jump straight to the [session review reference](/docs/session-review/tools-reference) to see every tool your agent gets. # Privacy and PII Governance for Agent Sessions in Subtext Source: https://subtext.fullstory.com/docs/privacy/overview Subtext masks form inputs from the moment you install, and gives your agent tools to scan sessions for PII and govern masking rules across all sessions. Feeding session data to an agent means feeding it whatever your users typed — emails, passwords, card numbers, and anything else that ended up in a form field. Subtext addresses this head-on with layered protection: a hard baseline that activates on install, and a full agent-driven governance loop you can run on real sessions whenever your coverage needs to grow. ## The challenge When your agent opens a session replay to diagnose a bug or trace a user journey, it reads the same event stream the recorder captured. That stream can contain raw input values from every text field a user touched. Without protection, sensitive data flows directly into your agent's context window — and potentially into logs, traces, or model inputs downstream. The risk is not hypothetical. A single session touching a checkout flow or an account settings page can contain payment card numbers, passwords, and personal identifiers all in the same recording. ## Baseline protection Subtext masks form inputs from the moment you install. No configuration required. Field values — passwords, credit card numbers, anything typed into an ``, `