Skip to content

Understand how people use the atlas #260

Open
2 of 3 issues completed
Open

Description

@Ardnived

The goal

We can see how visitors use the atlas: which parts they open, and how often they go on to register for a class or share one. We can also see, accurately, how much each client site uses the service. We learn both without recognising individual people.

Why it matters

We make decisions about the atlas without knowing how it is used. Today we know nothing at all: the analytics service was wired up but never switched on in production, so no visitor has ever been counted, and the integrator guide describes a flow that never runs. Separately, the usage figure we keep for each client site is inflated, which makes the service look busier than it is and can raise a false alarm about a site abusing it.

What success looks like

  • Someone outside the dev team can open one page and see, for the last month, how many people opened the atlas, how many searched, how many opened a class, how many started registering, and how many finished.
  • Those numbers can be broken down by which website the atlas was embedded in, and the breakdown names at least two different sites.
  • The numbers are demonstrably live, not merely configured: a named person browses the live atlas, and within a day their visit shows up in the report.
  • A sidebar embed nobody opens produces no visitor record, by design, and the report says so where the numbers are read, so a quiet site is not mistaken for a broken one.
  • Nothing new is stored in the visitor's browser, and no new way of recognising the same person across visits is added. Anything a host site can observe is written into the integrator guide and the changelog in the same change.
  • A written answer exists to "how long is this kept, and who can see it", naming who owns the account, before the first number is collected.

Not included

  • The client-site usage figure. It is its own goal now, We know accurately how much each client site uses the atlas SahajCloud#1015.
  • Advertising or selling data. Nothing like that is in scope.
  • Reporting what visitors typed into the search box. This is the one addition that would put the privacy promise at risk, and we have already promised host sites we never send it.
  • Letting a host site switch analytics off from its embed snippet. We removed that switch deliberately; the equivalent is a setting we hold, not one an editor edits.
  • Recognising the same visitor across separate visits, which would need something stored in the host site's browser storage.
  • Measuring panning, zooming and marker clicks on the map. High volume, little decision value.
  • Changing how often an embed reports itself, and retuning the abuse alerting. Both are adjacent and separately ticketed.

Decisions

These two were settled before this goal was written. They are recorded here so the goal is not re-litigated, and so the next reader can see they are closed.

  • Do we report what a visitor typed in the search box? → No. The atlas sends the route only and never the typed text, and the integrator guide promises host sites exactly that (recorded in the guide's privacy section; no ticket).
  • Can a host site turn analytics off from its embed snippet? → No. The snippet parameter was removed and the element reads no such attribute. What gates analytics is configuration we hold (recorded in feat(widget): split the embed into a smart loader and an element bundle #149).
  • Is this one goal or two? → Split it. Visitor insight stays here; the client-site usage figure is its own goal, We know accurately how much each client site uses the atlas SahajCloud#1015. (Ardnived, 2026-10-21)
  • Which analytics service, and who owns the account? → A service that can break numbers down by site, as the 2026-07 evaluation on feat(widget): instrument event surfaces + evaluate TelemetryDeck #51 recommended (TelemetryDeck). The account owner is still to be named. (Ardnived, 2026-10-21)
  • What counts as one "use"? → A visit: one per person per browsing session, held in memory only and forgotten when the tab closes, so nothing is written to the host site's storage. (Ardnived, 2026-10-21)

Open questions

None.

Notes

Related: #51, #109, #160, sydevs/SahajCloud#891

The inflated client-site figure is diagnosed in sydevs/SahajCloud#891, which already has an open pull request. That dependency belongs on the specific child ticket that covers the figure, not on this whole goal, so the rest of the work is not held up behind it.

Sub-issues

Sub-issues

2 of 3 Issues completed
Loading 3 sub-issues

Activity

  1. added theissue type on Oct 8, 2026
  2. added
    bot:working
    on Oct 8, 2026
  3. sydevs-bot commented on Oct 8, 2026

    @sydevs-bot
    Contributor

    🤖 no session running

    recent dispatches
    • 01:22Z revise-roadmap · attempt 1 · session · done
    • 01:22Z revise-roadmap · attempt 1 · session

    Written by the sydevs dispatcher. Sessions never edit this comment.

  4. sydevs-bot commented on Oct 8, 2026

    @sydevs-bot
    Contributor

    Technical notes for #260. Edited in place. Planning reads this; the body stays plain.

    The finding that reframes the goal: analytics has never run in production

    VITE_FATHOM_ID is unset on Pages Production, so there has never been pageview data. Evidence, from read-only GETs of the live deploy:

    • Crawled sahajatlas.com/ plus every assets/*.js it and auto.js reference — 20 chunks, 3.6 MB. Zero fathom, case-insensitive.
    • Not vacuous: the same crawl finds cloud.sydevelopers.com, api.mapbox.com, ipwho.is, o…ingest.de.sentry.io.
    • The deploy is current: cooperative (feat(embed): gestures=cooperative lets the host page scroll past a contained map #251) is present in FullInterface-BbpJZ-gK.js.
    • honorDNT is absent from that same chunk, though it is the literal in our own Fathom.load (src/views/FullInterface.tsx:77). The branch was dead-code-eliminated, which only happens when !!import.meta.env.VITE_FATHOM_ID folds to false at build time.
    • The control: VITE_SENTRY_DSN is Cloudflare-set (docs/environment.md:23) and its ingest host is in the bundle. VITE_FATHOM_ID is listed as .env.local only (docs/environment.md:31).

    So success line 1 starts from zero. docs/embedding.md:1088 describes a flow that never fires, and every host's CSP carries cdn.usefathom.com for nothing. This is the #232 failure class (Sentry DSN unset, zero events for seven weeks), and no gate catches it — tests/smoke/boot-origins.smoke.test.ts is where a presence assertion belongs.

    What exists today

    • One path: useAnalytics, src/views/FullInterface.tsx:60-88. load(auto: false, honorDNT: true) once per document; one trackPageview per distinct in-widget pathname, deduped by module-scope lastTracked. Pathname only, never location.search (:84-86).
    • Reached from App.tsx:390-404, so embed and standalone behave identically. In FullInterface, not AppShell, so a collapsed card reports nothing (src/components/AGENTS.md:325-340).
    • Attribution domain is the first line of allowedDomains (src/App.tsx:378-389), not a dedicated field. An empty list — which SahajCloud reads as "all origins" — yields '', so analytics is off for that client entirely.
    • Zero custom events: grep -rn "trackEvent\|trackGoal" src/ → 0 hits.
    • Per-client usage: usageTrackingBeforeOperationHook (SahajCloud/src/plugins/usage/hooks.ts:418-454), one atomic UPDATE per top-level client read, on every collection but clients and every global since SahajCloud#710. Feeds the admin display, HIGH_USAGE_THRESHOLD = 1000 alerts and abuseScore. Nothing throttles on it — rate limiting is a Cloudflare edge rule.

    Why the count is too high — four causes, ranked

    1. Unit mismatch. It counts HTTP requests — ~4-6 per boot (geojson, regions, the sy-atlas-config and sy-atlas-translations globals, plus /forms/:id on every page view) — per API key, while the goal asks per client site. One key serves up to 50 mounts.
    2. SahajCloud#891 — forwarded internal reads re-increment; a read selecting webPath/webUrl bills twice, and the atlas selects both (src/config/api/fetch.ts:119,138-139). Open PR SahajCloud#896 fixes it.
    3. Our own traffic lands on client counters: the standalone site shares a client key, preview deploys use the Preview copy, VerifyEmbeds renders host pages (booting the widget), and each live-preview edit triggers a populate read.
    4. Up to one retry per failed read (shouldRetryQuery, src/config/query-client.ts).

    Settled, so not an open question: POST /api/clients/report is NOT metered. clients is in the plugin's exclusion set (SahajCloud/src/plugins/usage/usagePlugin.ts:68), per SahajCloud/docs/rules/api-clients.md. So #160's cadence inflates request traffic and the 50-mount cap, not usage_daily_requests. Also ruled out: refetchOnWindowFocus is off (:!1 in the shipped bundle); a second widget or loader copy is refused; the smoke lanes read static files only.

    Packages and platforms weighed

    Candidate Verdict
    Fathom (wired, fathom-client@^3.7.2) Keep for pageviews. Events are name-only (trackEvent(name, {_value})) — no properties, so it cannot segment "how many registered" per site. Ad-blockable, so never a billing source.
    TelemetryDeck Properties + funnels, EU-hosted, ~1.1 KB gz, free ≤50k signals/mo. #51 already evaluated and recommended it on 2026-07-14 — do not re-run. Cost #51 missed: a new origin means every host must edit script-src/connect-src, and a host that does not silently loses all analytics.
    Cloudflare Web Analytics No custom events; measures our zones, not our embed in someone else's page. No.
    Workers Analytics Engine Cookieless and cheap, but no functions/ dir or wrangler config exists — this is "build a product-analytics platform". No.
    Server-side in SahajCloud The only thing that can answer line 3. user-submissions already carries an indexed, server-composed client relationship (fields.ts:619), so registration counts per client are an exact SQL query with zero new instrumentation and zero privacy delta.
    Plausible / Umami / PostHog None beats the above. PostHog persists a distinct_id by default, breaking the no-host-storage posture (#95).

    The four children

    ⚠ Corrected mid-run. These were parentless when this run began; all four were linked as sub-issues of #260 while it was in progress, so this section no longer describes them as adoptable candidates. They are the children.

    Child State Role in the goal
    #51 open, Feature, Low The visitor-insight half. Its phase-1 stack decision is now open question 2 on this goal. Companion #52 is closed, so #51's sequencing caveat is stale.
    #109 open, blocked, Hold Until 2026-11-15 The registration + share conversion slice. Parked twice by @Ardnived.
    #160 open, Task, Medium Report-cadence volume. Traffic hygiene only — not the count fix, per the settled fact above.
    sydevs/SahajCloud#891 open, Bug, Medium, PR #896 open The count fix. Likely lands before this goal does.

    No replan was requested, deliberately. Four open questions are unticked, and implement-roadmap cannot plan past an unsettled decision, so a replan session now would do nothing. Questions 1 and 2 also decide whether the goal splits and which backend the children target — replanning before those answers would be rework. The next step is the reviewer's answers, then @sydevs-bot implement.

    A fifth child is missing: nothing covers "switch analytics on and prove it stays on" (split item 1 below). Planning should file it.

    Where the lenses disagreed

    Scope said "no new origin for #260; keep Fathom's name-only events, defer the vendor to #51". Gaps said "adopt TelemetryDeck". Scope holds on the framing — a vendor migration is #51's goal — but it cannot meet success line 2, since name-only events cannot be split per site. So the vendor is a budget-and-ownership choice, raised as open question 2.

    Second: gaps wanted a session-scoped visit id; scope called sessions out of scope as needing host-origin storage. Resolution: an in-memory id held for the tab's life writes nothing to the host's origin, so #95 holds. Only a persisted id would reverse it, and that stays in ## Not included.

    Risks

    • A new origin is a host-facing contract change: a row in each of docs/embedding.md's two CSP tables, a privacy bullet, and a CHANGELOG.md entry in the same PR, plus ~31 client records to coordinate. Hosts that do not update fail silently.
    • "No personal data" is already not literally true: ipwho.is gets the visitor's IP once per session, Mapbox writes a persistent anonymous id, Sentry carries navigator.userAgent. The body now says no new collection — do not revert that wording.
    • Share completion is unobservable at any budget — it happens on a platform we do not own. Only "pressed a share target" is measurable.

    Sketch of a split (reviewability seams)

    1. Switch analytics on and prove it stays on — set the production variable, add a presence assertion beside the fix(report): nothing has ever reached the widget's Sentry project #232 Sentry entry in boot-origins.smoke.test.ts. Small, independent, prerequisite for every other visitor line. No child covers this yet.
    2. The event seam + the chosen backend — a general capability the rest then uses. Gated on open question 2. (feat(widget): instrument event surfaces + evaluate TelemetryDeck #51)
    3. Per-site counts from SahajCloud — registrations and reports grouped by client. No widget code, no CSP change.
    4. Correct the usage meter — adopt SahajCloud#891, gate the compact card's two metered global reads, and exclude our own traffic. Owned in SahajCloud. Blocked by: SahajCloud#891 belongs on that child, not on the goal.

    Could not settle

    🤖 Written by the sydevs autonomous loop — see what this is

  5. sydevs-bot commented on Oct 8, 2026

    @sydevs-bot
    Contributor

    The atlas has never had analytics in production. VITE_FATHOM_ID is unset on Pages Production, so the tracker is dead-code-eliminated from the shipped bundle — no trace of it in all 20 chunks of the live deploy, while the Sentry host is there as a control. Line 1 starts from zero.

    The inflated per-site count is diagnosed in sydevs/SahajCloud#891, which has an open PR. Deeper cause: the figure counts API requests per key, not visits per site. POST /api/clients/report is not metered, so #160 is traffic hygiene, not the count fix.

    I rewrote the body — sharper success lines, six items moved to ## Not included, two settled positions recorded. Detail is in the notes comment above.

    Four decisions need you, in ## Open questions: one goal or two, which analytics service and who owns the account, what the per-site figure is for, and what counts as one "use". Each has options and a recommendation. Reply @sydevs-bot revise 1A or in your own words.

    Once none are open, @sydevs-bot implement plans the implementation tickets.

    🤖 Written by the sydevs autonomous loop — see what this is


    Generated by Claude Code

  6. added and removed
    bot:working
    on Oct 8, 2026
  7. Ardnived commented on Oct 21, 2026

    @Ardnived
    ContributorAuthor

    Answered in the terminal by @Ardnived:

    The client-site usage figure is now its own goal, sydevs/SahajCloud#1015, with this goal's old question 3.

  8. added this to the Sahaj Atlas v3.1 milestone on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    Medium

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions