---
title: "Record Browser Route Analytics"
method: POST
path: "/routes/{run_id}/analytics"
tags: ["routes"]
---

# Record Browser Route Analytics

`POST /routes/{run_id}/analytics`

Retain a sanitized browser route funnel/outcome event.

## Path parameters

- `run_id` string, required

## Request body

- BrowserRouteAnalyticsRequest — Privacy-conscious browser funnel or route outcome event.
  - `event_type` string, required
  - `outcome` 'viewed' | 'selected' | 'rejected' | 'continued' | 'published' | 'shared' | 'downloaded' | 'abandoned' | 'error', nullable
  - `option_id` string, nullable
  - `route_id` string, nullable
  - `reason_code` string, nullable
  - `metadata` object

## Response `200`

Successful Response

- BrowserRouteAnalyticsResponse — Acknowledgement for a retained browser analytics event.
  - `accepted` boolean, required
  - `run` BrowserRouteRunSummary, required — Browser-safe route run metadata for history and resume. ``is_owner`` / ``can_refine`` default ``True`` because every serializer except the shared read (#1549) is owner-scoped; the non-owner projection clears them and nulls the owner-only fields below (session linkage, provenance, composer prompt, published pages), which is why those three are ``str | None`` even though the owner path always populates them.
    - `run_id` string, required
    - `browser_session_id` string, nullable, required
    - `status` string, required
    - `terminal_event_type` string, nullable
    - `parent_run_id` string, nullable
    - `root_run_id` string, nullable, required
    - `prompt_preview` string, nullable, required
    - `viewer_locale` string, required
    - `generation_locale` string, required
    - `units` string, required
    - `timezone` string, nullable
    - `location` BrowserRouteLocationSummary, required — Approximate browser-shared location retained for history/analytics.
      - `lat_approx` number, nullable
      - `lng_approx` number, nullable
      - `accuracy_m` number, nullable
      - `captured_at` string, date-time, nullable
    - `candidate_summaries` object[]
    - `source_route_hash` string, nullable
    - `source_route_slug` string, nullable
    - `source_public_route_id` string, nullable
    - `source_session_id` string, nullable
    - `published_route_pages` BrowserRoutePublishedPage[]
      - `share_id` string, required
      - `slug` string, required
      - `page_url` string, required
      - `page_path` string, required
      - `manifest_url` string, required
      - `manifest_path` string, required
      - `title` string, nullable
      - `description` string, nullable
      - `option_id` string, nullable
      - `label` string, nullable
      - `route_id` string, nullable
      - `published_at` string, date-time, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `completed_at` string, date-time, nullable
    - `is_owner` boolean
    - `can_refine` boolean

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/imperfect/apis/imperfect-api.md) · [All operations](https://skmtc.dev/imperfect/apis/imperfect-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/imperfect/imperfect-api/revisions/cc2293a44257/schema)
