ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

[Feature]: More options how to filter click events

Open krystofmatejka opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. ai-apps

If you have APP 2 as a part of APP 1, there isn't any possibility of collecting clickanalytics events only from the inner (APP 2) application.

dntDataTag works the other way around. You can apply it to APP 2 and prevent APP 2 from collecting metrics.

Describe the solution you'd like

  1. I would implement filter callback that would be called when the event is processed. If the callback returns false, the event will be dropped.

Proposed interface

export interface IValueCallback {
  dropEvent?: (event: ITelemetryItem): boolean;
}
  1. Or we can introduce something like dontDntDataTag attribute that would capture events only from elements that have this parent attribute. You would apply it on root element of APP 2 and everything from APP 1 will be ignored.

Describe alternatives you've considered My current solution is to filter events by parentId in KQL.

Additional context If it makes sense to you, I'm willing to implement it.

krystofmatejka avatar May 22 '24 17:05 krystofmatejka

one workaround is set parentDataTag https://github.com/microsoft/ApplicationInsights-JS/blob/767790b9011cc032dd9a9763fa7e6714de1cd527/extensions/applicationinsights-clickanalytics-js/src/Interfaces/Datamodel.ts#L83 of App2 to a different one, and mark app1 as do not track. please let us know if it works!

Karlie-777 avatar May 30 '24 22:05 Karlie-777

This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.

github-actions[bot] avatar Mar 27 '25 07:03 github-actions[bot]

Hello @Karlie-777 this would work if you were in a position where you can modify app1. Unfortunately, that is not my case.

krystofmatejka avatar Mar 27 '25 07:03 krystofmatejka

Is there any tag id/properties/telemetry fields that can identify if the events are from app1 or app2? If it does, then you can apply telemetryInitializer https://github.com/microsoft/ApplicationInsights-JS?tab=readme-ov-file#telemetry-initializers this handler allows you to modify any events before sent out. So once you identify the events are from app1 and you return false inside telemetry initializer, then the events from app1 can be dropped.

Karlie-777 avatar Mar 27 '25 20:03 Karlie-777

This Issue will be closed in 30 days. Please remove the "Stale" label or comment to avoid closure with no action.

github-actions[bot] avatar Nov 23 '25 07:11 github-actions[bot]