Repository navigation
[ClickAnalytics] Make input type capture configurable via trackInputTypes - #2787
Merged
Hector Hernandez (hectorhdzg) merged 3 commits intoNov 3, 2026
Merged
Conversation
- Replace the hardcoded <input> type allowlist with the trackInputTypes config (default BUTTON,CHECKBOX,RADIO,RESET,SUBMIT), supporting dynamic config changes - Never use the value of other input types as the default content name to avoid collecting user entered data - Re-attach auto capture listeners after every config change; the previous handler was unloaded so dynamic changes stopped auto capture - Document trackElementTypes, trackInputTypes and input capture behavior Fixes #2771 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Lowercase XHTML input tags bypass the privacy guard and can expose user-entered values in telemetry.
1 open issue
What changed in this PR
This PR makes ClickAnalytics input-type capture configurable while preserving the default allowlist. It also adds protection against capturing typed values and fixes listener reattachment after configuration changes.
Changes:
- Adds
trackInputTypeswith runtime configuration support. - Adds an input-value privacy guard and restores auto-capture listeners after configuration updates.
- Documents input filtering and adds tests for defaults, dynamic opt-in, and value exclusion.
| File | Description |
|---|---|
extensions/applicationinsights-clickanalytics-js/Tests/Unit/src/ClickEventTest.ts |
Tests input filtering, runtime updates, and value exclusion. |
extensions/applicationinsights-clickanalytics-js/src/Interfaces/Datamodel.ts |
Declares and documents trackInputTypes. |
extensions/applicationinsights-clickanalytics-js/src/handlers/DomContentHandler.ts |
Restricts input values used as default content names. |
extensions/applicationinsights-clickanalytics-js/src/handlers/AutoCaptureHandler.ts |
Parses and applies configurable input-type filtering. |
extensions/applicationinsights-clickanalytics-js/src/ClickAnalyticsPlugin.ts |
Adds defaults and reattaches listeners after configuration changes. |
extensions/applicationinsights-clickanalytics-js/README.md |
Documents filtering options and input privacy behavior. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Jackson Weber (JacksonWeber)
approved these changes
Nov 3, 2026
Hector Hernandez (hectorhdzg)
deleted the
hectorh/click-analytics-input-types
branch
November 3, 2026 22:45
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.

Summary
Fixes #2771.
ClickAnalytics auto capture used a hardcoded
<input>type allowlist (button,checkbox,radio,reset,submit) that was independent oftrackElementTypesand not documented. IncludingINPUTintrackElementTypessilently ignored clicks ontext,email,number,searchand untyped inputs.Changes
trackInputTypesconfig: comma separated list of<input>typevalues to auto capture. The defaultBUTTON,CHECKBOX,RADIO,RESET,SUBMITkeeps existing behavior. Case and whitespace insensitive, and supports dynamic config changes.valueof input types other thanbutton,checkbox,radio,resetandsubmitis never used as the default content name; it falls back toname,altorid. Opting in to text-like inputs cannot leak user entered data through the content name. This also applies to manualcapturePageActioncalls on such inputs, which previously could use the typed value.AutoCaptureHandler(removing its listeners) and creates a new one, but only calledclick()whenautoCapturetransitioned from off to on. Any runtime config change therefore silently stopped auto capture, includingtrackElementTypeschanges. Listeners are now re-attached wheneverautoCaptureis enabled.trackElementTypes,trackInputTypesand the input capture behavior.Validation
rush build --to @microsoft/applicationinsights-clickanalytics-jsnpm testinextensions/applicationinsights-clickanalytics-js: 27 tests, 0 failed. New test covers default filtering, untyped inputs, dynamic opt-in, typed values not being captured, and an empty list disabling input capture.npm run lint-fix