Repository navigation
Conversation
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>
abonneth
requested review from
JulesBelveze,
enguerran-leclerc,
keqili-h and
maxime-hcompany
as code owners
October 9, 2026 15:51
enguerran-leclerc
approved these changes
Oct 9, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Made with Cursor