Skip to content

Click Analytics - Fix capturning of HTML events #2587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Barry-RG
Copy link

Changes made in #2504 (b5a24d5) appear to have introduced an issue when evaluating if events have come from known HTML objects. This appears to be due to a new array which had previously been an object still being indexed by its values. As a result these events are not being processed.

This change is to fix that by looking for the value in the array.

@Copilot Copilot AI review requested due to automatic review settings June 12, 2025 11:06
@Barry-RG Barry-RG requested a review from a team as a code owner June 12, 2025 11:06
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where HTML event sources were not recognized after changing the capture-element map from an object to an array by using arrIncludes for lookups.

  • Imported arrIncludes and replaced direct object-index checks with arrIncludes for element tag matching.
  • Updated two conditionals in AutoCaptureHandler.ts to use array-based inclusion logic.
Comments suppressed due to low confidence (1)

extensions/applicationinsights-clickanalytics-js/src/handlers/AutoCaptureHandler.ts:99

  • Consider adding unit tests for the new array-based inclusion logic, including a scenario where a <label> with a for attribute maps to its control, to prevent future regressions.
if (!arrIncludes(_clickCaptureElements, tagNameUpperCased)) {

@Karlie-777
Copy link
Contributor

#2589

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.

2 participants