/agent-skills:dd-instrument-product-analyticsfrom agent-skills
Enables Datadog Product Analytics (funnels, retention, pathways, user journeys) for a browser app already using the Datadog RUM Browser SDK. Configures the RUM application, ties sessions to signed-in users, and verifies event delivery.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Product Analytics turns the sessions, page views and clicks that the Datadog RUM Browser SDK collects into funnels, retention, pathways and per-user journeys. It uses the same SDK and the same RUM application as RUM, so there is no second SDK to install.
product_analytics_retention_state: MAX. Without it, Product Analytics stays disabled even when the code is correct.datadogRum.setUser. Without it, no journey is tied to an account. From SDK v6, visitors without a login are still counted anonymously, because trackAnonymousUser defaults to true; v5 has no anonymous id.trackUserInteractions defaults to true from SDK v6 and to false in v5. SDK v4 and older name the option trackInteractions.Inspect. If the request or target project is a mobile app (iOS, Android, React Native, Flutter, or Kotlin Multiplatform), stop before any browser search or edit: say that this skill is for the browser product (@datadog/browser-rum) only, and do not give the Manage Applications enable path. Otherwise, find the browser app; in a monorepo with several, ask which one. Search source and HTML files, skipping node_modules and build output, for the RUM setup: an init call on the datadogRum import from @datadog/browser-rum, including renamed imports and wrapper modules, or a CDN DD_RUM.init. Record the number of inits, the SDK version, trackUserInteractions, the site (absent means datadoghq.com), the application ID, and how users sign in, through an auth library or the app's own session or user state. When the init reads the application ID or the site from environment variables, read only those lines of the env file, for example grep -E '^VITE_DD_(RUM_APPLICATION_ID|SITE)=' .env.local, because env files often hold secrets.
Check what Product Analytics needs.
dd-instrument-rum skill. Ask whether to set up RUM now, and close with the blocked: RUM missing summary below (naming dd-instrument-rum and asking whether to run it) instead of the settings step. On yes, run that skill; when it is not installed, get it from that link or follow the Browser Monitoring setup docs, then restart at step 1, and if there is still no init with an application ID, stop and report it.ddog-gov.com or us2.ddog-gov.com: stop and report that Product Analytics is not available on those sites.Turn Product Analytics on. Check for both keys without printing them: [ -n "$DD_API_KEY" ] && [ -n "$DD_APP_KEY" ] && echo set. With keys, follow references/api-switch.md: it reads the current state, records whether the application is in preview, and sends only product_analytics_retention_state: MAX. Without keys, or after a failure, give the user the settings step: in Datadog, open Digital Experience > Real User Monitoring > Manage Applications, select the application, then under PRODUCT SETTINGS click Product Analytics and Enable. Build APP_HOST as described in Verify and view. When the Datadog MCP server has the RUM toolset, Datadog:search_rum_applications reports product_analytics_retention_state, which confirms either path.
Tie sessions to users.
datadogRum.setUser({ id: String(user.id), name: user.name, email: user.email }) where the signed-in user first becomes available in the browser: the nearest provider, layout or root component that holds the user, such as a useSession(), useUser() or onAuthStateChanged consumer, rather than a leaf component. id must be stable; name and email are optional. When the user object has no id, use another stable unique value the app holds for that user, and make no call while it is undefined, because String(undefined) is the literal "undefined", which merges every user into one. Call datadogRum.clearUser() where the user signs out. The SDK runs only in the browser, so in server-rendered apps such as Next.js make these calls in a client component or effect. With a CDN setup, wrap them in window.DD_RUM.onReady(() => …).setUser call. Leave one comment after the init that shows the call to add once a real user identity exists. On SDK v5, tell the user that counting anonymous visitors needs SDK v6 or later.setUser call already exists: keep it.Make sure clicks are collected. On SDK v5 (see the manifest, or a CDN loader URL such as …/us1/v5/datadog-rum.js or datadog-rum-v4.js), add trackUserInteractions: true to the existing init when it is absent; on v4 and older, the option is trackInteractions. When the init sets it to false, ask before changing it. Leave every other init option, the credentials and the plugins as they are.
Build and run. Run the project's build, fix errors your edits caused, and run it again until it passes. Then start the app with its dev command, load a page, click an element, keep the page open for about 30 seconds, and stop the server. The SDK sends its batch every 30 seconds or when the page is hidden, so a check right after the click can find nothing.
Record the highest level you actually reached:
browser-intake-… host, or to the init's proxy URL, with path /api/v2/rum, returned 202. Check in a headless browser when one is available, or ask the user to look in DevTools > Network. An ad blocker can block the request, and a sessionSampleRate below 100 can leave the test session out.Datadog:search_datadog_rum_events, or the Search RUM events endpoint with the same keys, finds @application.id:<APP_ID> @session.initial_view.url_host:localhost in the last 15 minutes. Use the dev server's host, so existing traffic does not count. A new application can take a few minutes to show data, so query once a minute for up to 10 minutes after the click; if nothing arrives, stop at level 3 and give the link.A passing build shows only that the project compiles. Name each level you could not check and the step left for the user, such as signing in once to see their own user.
The app host is app.datadoghq.com for datadoghq.com, app.datadoghq.eu for datadoghq.eu, and the site itself for the others, for example us5.datadoghq.com. End with this summary (when step 1 or 2 stops before step 3, use the blocked: status instead of the settings step and omit View:):
Product Analytics: turned on | already on | waiting for your settings step (<the step>) | blocked: RUM missing (run dd-instrument-rum first — set up RUM now?) | blocked: <reason>
Changed: <files, or none>
Evidence: <highest level reached, or none>; not checked: <levels and the step left>
View: https://APP_HOST/[email protected]:<APP_ID>
Revert this run's code edits: setUser, clearUser, the comment, and trackUserInteractions. If this run turned Product Analytics on, follow the undo note in references/api-switch.md: turning it on ends a new application's preview, and undoing does not bring the preview back. Leave the RUM setup as it is.
| Mistake | Symptom | Fix |
|---|---|---|
setUser({ id: 'anonymous' }) or another literal id | Every session merges into one user, so funnels and retention break | Use the real user id, or no call |
setUser called in server code | Events carry no user | Call it in browser code |
SDK v5 init without trackUserInteractions | Views arrive, clicks do not, so funnels on actions stay empty | Step 5 |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
datadog, product-analytics, rum, browser-rum, funnels, retention, user-journeys
npx claudepluginhub datadog-labs/agent-skills --plugin agent-skills78 skills in this plugin
/agent-observability-auto-experimentRun an iterative code-improvement hill-climb against real Datadog LLM-Obs data, locally, with Claude Code as the agent. Establishes a baseline eval, makes one focused change, re-scores both splits with the same harness, keeps the change when held-out test improves without overfitting val (labeling within-noise gains tentative), and repeats. This is the skill published as "Autoresearch" in Datadog Agent Observability. Use when the user says "run an auto experiment", "run autoresearch", "hill-climb this code", "iteratively improve X and measure the delta", "optimize this code/agent/pipeline/prompt against my traces", "auto-optimize against LLM-Obs", or wants the local equivalent of the auto_experiments worker. Works from an ml_app, a dataset_id, an annotation_queue_id (a queue of human-labelled interactions), a list of trace_ids, or (by exception) a local dataset file. The corpus and its val/test splits live in Datadog LLM-Obs Datasets, created once per run with a timestamp in their names./agent-observability-build-eval-from-annotationsFit a Datadog LLM-Obs evaluator to human labels. Takes an annotation queue, works out where in the trace the labelled property actually lives, drafts an LLM-judge that predicts the human label, scores that judge against the already-labelled rows with a metric agreed with the user, then hill-climbs it — inspect the errors, make one focused change, re-score, keep it only if it beats the best — for a bounded number of iterations, and finally publishes the winner to Datadog as a DISABLED evaluator (not a Datadog draft — a real evaluator with `enabled: false`). Use when the user says "build an eval from my annotations", "build an evaluator from the annotation queue", "turn my annotations into an evaluator", "learn an evaluator from my labels", "fit a judge to the annotation queue", "auto-label", "auto labelling", "automate this annotation queue", "scale up my human labels", or wants the rest of a queue graded the way the humans graded the first rows. Needs an annotation queue with at least two classes present in the human labels (e.g. one true and one false for a boolean)./agent-observability-eval-bootstrapBootstrap evaluators from production traces — by default propose online LLM-judge evaluators and, after you confirm, create them in Datadog as disabled drafts (never auto-enabled); on request emit Python SDK code or a framework-agnostic JSON spec instead. Use when user says "bootstrap evaluators", "generate evaluators", "create evals from traces", "eval bootstrap", "write evaluators", "build eval suite", "publish evaluators", or wants to generate BaseEvaluator/LLMJudge code or online judge configs from production LLM trace data. Works with ml_app and optional RCA report or failure hypothesis./agent-observability-eval-pipelineEnd-to-end Agent Observability pipeline for an instrumented ml_app — classify production traces, root-cause failures, bootstrap evaluators, then (optionally) sample + publish a dataset, generate + run an experiment, and analyze results. Six narrated phases with a standardized banner and a "continue" checkpoint between each. Pure orchestration over the agent-observability sub-skills (`agent-observability-session-classify`, `agent-observability-trace-rca`, `agent-observability-eval-bootstrap`, `agent-observability-experiment-bootstrap`, `agent-observability-experiment-analyzer`). Use when user says "run the eval pipeline", "go from traces to evals", "bootstrap evals end to end", "classify then RCA then bootstrap", "build an eval set from scratch", "onboard me to datasets and experiments", "walk me through experiments", "I have an ml_app, now what", "Agent Observability onboarding", "guided experiment setup", "from traces to experiments", or wants a deterministic, narrated tour from production data through evaluators, datasets, and experiments. Stop early with `--stop-after <phase>` to short-circuit at evaluators or dataset, or resume mid-flow with `--start-at <phase>`./agent-observability-experiment-analyzerAnalyze LLM experiment results. Handles single or comparative experiments, exploratory or Q&A modes. Use when user says "analyze experiment", "compare experiments", "analyze against baseline", or provides one or two experiment IDs for analysis./agent-observability-experiment-bootstrapBootstrap a reproducible LLM Observability experiment through the Python ddtrace SDK or the Node dd-trace SDK. Use for experiment, dataset, evaluator, benchmark, regression, or LLM-as-a-judge scaffolding. The legacy Python invocation remains supported.Other plugins' skills for the same job