ContentGrapher
ContentGrapher
← Changelog
New2026-05-26

Anonymous Users Now Navigate to a Persistent Report URL

Anonymous users are now navigated to /report/[id] after analysis completes, with their device token used to authenticate the page load. The report persists across tab reloads as long as the device token is in localStorage.

Problem

Anonymous users completed the full analysis pipeline at a 6:1 ratio over authenticated users, but were never navigated to `/report/[id]` — only authenticated users received that navigation. Anonymous users landed back on `/dashboard` with no permalink, no durable artifact, and no way to return to their results. The data existed in the database; the access path did not.

Context

The `device_token` column already existed on the `analyses` table, and the `X-Device-Token` header pattern was already used by `authorizePhase2` and `share/route.ts`. This feature extends the same pattern to `GET /api/analyses/[id]`: when no session user is present, the API now accepts ownership proof via an `X-Device-Token` header and queries `WHERE id = $1 AND user_id IS NULL AND device_token = $2 AND status = 'complete'`. The authenticated path is unchanged.

What changed

- `GET /api/analyses/[id]` accepts `X-Device-Token` for unauthenticated requests. The token must be a valid UUID; mismatches return 404, absent or malformed tokens return 401. - The dashboard now navigates all users (not just authenticated) to `/report/[navId]?src=analysis` on analysis completion. - The report page reads `cg_device_token` from localStorage and attaches it as `X-Device-Token` on the analysis fetch. - 401 responses on the report page now render an error state in place rather than redirecting to `/dashboard`. - The error state includes a sign-in CTA: "This analysis was stored in your browser. Sign in to save future analyses permanently." - Anonymous users viewing a report see a dismissible conversion bar ("This analysis lives in your browser. Sign in to save it permanently.") and an inline CTA after the Writing Agenda card ("Re-analyze after you make changes to see which gaps close. Sign in to enable re-analysis →"). - A `report_viewed` analytics event fires on report load with `{ auth: boolean, source: 'post_analysis' | 'direct_nav' }`.

How to verify

Open an incognito window, run a full analysis, and confirm navigation to `/report/[id]`. Close the tab, reopen the URL in the same browser, and confirm the page loads. Clear localStorage and reload to confirm the error state appears with the sign-in CTA and no redirect. Confirm authenticated users still navigate to the report and load it identically to before.