From db8c9122aa629deb63beeebc1806e3e81d88fdf9 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 29 Sep 2021 10:41:16 +0200 Subject: [PATCH] add support for interaction events (#39752) --- .../analytics/ApplicationInsightsBackend.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts b/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts index 0405a4cecb7..96dacbc9081 100644 --- a/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts +++ b/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts @@ -1,5 +1,12 @@ import $ from 'jquery'; -import { EchoBackend, EchoEventType, isInteractionEvent, isPageviewEvent, PageviewEchoEvent } from '@grafana/runtime'; +import { + EchoBackend, + EchoEventType, + InteractionEchoEvent, + isInteractionEvent, + isPageviewEvent, + PageviewEchoEvent, +} from '@grafana/runtime'; export interface ApplicationInsightsBackendOptions { connectionString: string; @@ -7,7 +14,7 @@ export interface ApplicationInsightsBackendOptions { } export class ApplicationInsightsBackend implements EchoBackend { - supportedEvents = [EchoEventType.Pageview]; + supportedEvents = [EchoEventType.Pageview, EchoEventType.Interaction]; constructor(public options: ApplicationInsightsBackendOptions) { $.ajax({ @@ -26,7 +33,7 @@ export class ApplicationInsightsBackend implements EchoBackend { + addEvent = (e: PageviewEchoEvent | InteractionEchoEvent) => { if (!(window as any).applicationInsights) { return; } @@ -36,7 +43,7 @@ export class ApplicationInsightsBackend implements EchoBackend