From 6c2e97f84e5b9f8e625cf3d202fe4d4f98a5acfa Mon Sep 17 00:00:00 2001 From: Purvi Kanal Date: Fri, 20 Oct 2023 12:11:10 -0400 Subject: [PATCH] add event listeners for each event on init --- .../src/instrumentation.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/web/opentelemetry-instrumentation-user-interaction/src/instrumentation.ts b/plugins/web/opentelemetry-instrumentation-user-interaction/src/instrumentation.ts index 1a12953fc4..4f38f48095 100644 --- a/plugins/web/opentelemetry-instrumentation-user-interaction/src/instrumentation.ts +++ b/plugins/web/opentelemetry-instrumentation-user-interaction/src/instrumentation.ts @@ -72,9 +72,14 @@ export class UserInteractionInstrumentation extends InstrumentationBase typeof config?.shouldPreventSpanCreation === 'function' ? config.shouldPreventSpanCreation : defaultShouldPreventSpanCreation; + this.init(); } - init() {} + init() { + this._eventNames.forEach(event => { + window.addEventListener(event, () => {}); + }); + } /** * This will check if last task was timeout and will save the time to