microsoft / ApplicationInsights-JS

Microsoft Application Insights SDK for JavaScript
MIT License
646 stars 237 forks source link

Click analytics not logging no native html input elements #2136

Open blockingHD opened 1 year ago

blockingHD commented 1 year ago

Is your feature request related to a problem? Please describe. We are trying to implement Click Analytics in an Angular app and would like to be able to collect click data from more than just 'standard' HTML input elements. As an example we have a mat-card with a button within it. Both the card and the button perform the same action but I want to know which the user clicked.

Describe the solution you'd like I would like a configurable include list of elements that will be recorded.

Describe alternatives you've considered Equally logging anything where a data-id property exists would also be effective for our use.

MSNev commented 1 year ago

Simplistically, this "could" be implemented by abstracting this field out into a configuration https://github.com/microsoft/ApplicationInsights-JS/blob/8f53f2d4e2dc4e180e5dc918d34d8ae7499306ac/extensions/applicationinsights-clickanalytics-js/src/handlers/AutoCaptureHandler.ts#L61

But there may be some additional code required that I've not located based on my first simple look for the size of this requested enhancement (which I think is a good addition)