Skip to content

feat(plugin-autocapture-browser): add captureCssClasses option (DMT-525)#1770

Open
Dogfalo wants to merge 2 commits into
mainfrom
DMT-525-filter-css-classes-hierarchy
Open

feat(plugin-autocapture-browser): add captureCssClasses option (DMT-525)#1770
Dogfalo wants to merge 2 commits into
mainfrom
DMT-525-filter-css-classes-hierarchy

Conversation

@Dogfalo
Copy link
Copy Markdown
Collaborator

@Dogfalo Dogfalo commented May 22, 2026

Summary

  • Adds new elementInteractions.captureCssClasses option (default true). When set to false, the classes field is omitted entirely from every entry in the captured element-interaction hierarchy — not present as null, not as [].
  • Scope is limited to the hierarchy classes field. The top-level [Amplitude] Element Class event property is intentionally unaffected.
  • DataExtractor reads the effective value live from the options bag on every capture (not cached at construction), so in-place updates delivered via the existing elementInteractions remote-config channel — the same pattern used for pageActions — are honored on the next capture without SDK reinitialization.
  • The live options bag is forwarded to the Visual Labeling selector iframe via the messenger handshake (new elementInteractionsOptions field) so the UI / AI flows can branch on captureCssClasses and stay consistent with what the SDK is capturing.

Test plan

  • pnpm --filter @amplitude/plugin-autocapture-browser test passes, including the new suites:
    • data-extractor.test.tscaptureCssClasses option threading (default-on byte-equivalence, off path omits field entirely, top-level [Amplitude] Element Class still populated, in-place options-bag flips honored on next capture in both directions).
    • hierarchy.test.tscaptureCssClasses option (default / explicit-true / explicit-false / sensitive-input cases).
    • default-event-tracking-advanced.test.ts → live elementInteractionsOptions reference passed to enableVisualTagging.
  • Default-on JSON output is byte-equivalent to previous SDK versions (covered by the byte-equivalence assertion).
  • Manual: with captureCssClasses: false, verify a real click event in the browser produces an [Amplitude] Element Hierarchy payload that contains no "classes" key while [Amplitude] Element Class is still populated.

🤖 Generated with Claude Code

Adds an `elementInteractions.captureCssClasses` option (default true) that,
when set to false, omits the `classes` field from every entry in the
captured element-interaction hierarchy. The top-level
`[Amplitude] Element Class` property is intentionally not affected.

The effective value is read live from the options bag on every capture so
that in-place updates delivered via the existing `elementInteractions`
remote-config channel (the same pattern used for `pageActions`) are
honored on the next capture without SDK reinitialization. The live
options bag is also forwarded to the Visual Labeling selector iframe via
the messenger handshake so the UI / AI flows stay consistent with what
the SDK is capturing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 22, 2026

DMT-525

…sClasses

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

size-limit report 📦

Path Size
packages/analytics-browser/lib/scripts/amplitude-min.js.gz 58.35 KB (+0.08% 🔺)
packages/session-replay-browser/lib/scripts/session-replay-browser-min.js.gz 131.96 KB (0%)
packages/unified/lib/scripts/amplitude-min.umd.js.gz 208.99 KB (+0.03% 🔺)

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.

1 participant