Skip to content

Sync from the private repo - #4

Merged
abonneth merged 17 commits into
mainfrom
sync
Oct 9, 2026
Merged

abonneth merged 17 commits into
mainfrom
sync

Conversation

@abonneth

@abonneth abonneth commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Made with Cursor

leone-hai and others added 7 commits October 9, 2026 16:39
A before_send scrubber drops text and labels inside ph-private areas (chat, account, Holo's captions), labels inside ph-private-labels (gallery tooltips), and redacts emails everywhere; clicks and UI labels are kept.
Stops user-written text from reaching PostHog through autocapture, while keeping click tracking and UI labels.

**Why**: autocapture records the text and the `title` / `alt` / `aria-label` of the clicked element and of its parents (`$elements_chain`). Since launch it collected chat prompts ("make it much bigger and prettier", a full LLM build request), Holo's reference captions, prompts from gallery tooltips, and account emails, one of them an external user's.

**How**
- `privateText.ts`: a `before_send` hook for `$autocapture`. Inside an element marked `ph-private` it drops text and labels; inside `ph-private-labels` it drops only `title` / `alt` / `aria-label`; any email anywhere becomes `[email]`. The click itself is still sent, so counts are unchanged.
- Marked `ph-private`: chat messages (user, assistant, queued, live), the account menu's name and email, Holo's reference captions. Marked `ph-private-labels`: gallery cards, whose tooltip is the prompt while the visible build name stays.
- Kept as before: button and menu labels ("Share", "Publish", "Move left (←, A)"), build names in visible text.

`ph-no-capture` / `ph-sensitive` were not used: in posthog-js both drop the whole click, not just its text.

**Checked**: typecheck, Prettier, build. The scrubber passed 7 cases built from real chains: UI labels kept, a chat prompt dropped with the click kept, labels on a button inside a message dropped, the gallery tooltip dropped with the build name kept, an email redacted, and a `;` inside a value not splitting the chain. After deploy I check production chains in PostHog.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
leone-hai and others added 10 commits October 9, 2026 16:06
build_liked when the server saves a heart, link_opened with a named destination (holotab, github, pick_a_brick, bricklink, else the hostname) for every link to another site, and holotab_request_copied when the BrickLink request for HoloTab is copied.
Registers model (HOLO.id, e.g. holo4-27b) next to site, so builds and every other event can be split by the model that served them.
On a signed-in load, registers internal (email ends in @hcompany.ai) next to site and model; only the boolean is sent, and PostHog keeps it on that browser for later visits.
Same property name as h-data's events and person property, so one filter covers website and server events; still only a boolean from the email domain, never an id.
capture_exceptions records JavaScript errors as $exception, behind the same consent; before_send replaces any email in their properties, since error messages can quote the page.
build_viewed with the build's name (as the page title shows it) and where it was opened from (public, session, fork, showcase), sent when the open build's name is known; new, unnamed builds are skipped.
lego.com, bricklink.com and the hcompany.ai gate (analytics and GTM) now match the domain or a subdomain only, so a lookalike host such as evillego.com is not counted as Pick a Brick. Addresses the CodeQL incomplete URL substring alerts.
…el, is_internal, errors (#131)

Lands the analytics tracking from #128 on `master`. #128 was stacked on the privacy PR and merged into `leone/analytics-private-text` after that branch was already merged, so none of it reached `master` or production.

**What ships** (all text-free except build names, which are kept on purpose):
- `holobricks.build_liked` (`liked`), when the server saves a heart.
- `holobricks.link_opened` (`to`: holotab, github, pick_a_brick, bricklink, or the hostname) for every link to another site.
- `holobricks.holotab_request_copied` when the HoloTab shopping request is copied.
- **New:** `holobricks.build_viewed` (`title`: the build's name, `source`: public, session, fork or showcase) when an open build's name is known. Pageview titles are recorded before the app sets the build's title, so most of them read as the home page.
- `model` (`holo4-27b`) and `is_internal` (from the signed-in email domain, never the email) registered on every event.
- Browser errors as `$exception`, emails redacted.

**Checked**: merges cleanly into `master`; typecheck and build pass.
@abonneth
abonneth merged commit 4572515 into main Oct 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants