From 98811cd6d0f7ffc2883e5a1c1835d835ae24e880 Mon Sep 17 00:00:00 2001 From: Karl-Emil Kjaer Bilstrup Date: Mon, 6 May 2024 11:48:18 +0200 Subject: [PATCH 1/2] Tested custom events --- src/appInsights.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/appInsights.ts b/src/appInsights.ts index cc421f112..208bac74c 100644 --- a/src/appInsights.ts +++ b/src/appInsights.ts @@ -9,8 +9,10 @@ import CookieManager from './script/CookieManager'; const load = () => { if (CookieManager.getComplianceChoices().analytics) { + console.log("Track data") appInsights.loadAppInsights(); appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview + appInsights.trackEvent({name: 'Test event'}); } }; const appInsights = new ApplicationInsights({ From 3dcb5e8222e5709b592182a6a13b934ed1412e03 Mon Sep 17 00:00:00 2001 From: Karl-Emil Kjaer Bilstrup Date: Mon, 6 May 2024 15:10:38 +0200 Subject: [PATCH 2/2] track train event --- src/appInsights.ts | 4 +--- src/pages/training/TrainingPage.svelte | 14 +++++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/appInsights.ts b/src/appInsights.ts index 208bac74c..a2bdbccc4 100644 --- a/src/appInsights.ts +++ b/src/appInsights.ts @@ -9,13 +9,11 @@ import CookieManager from './script/CookieManager'; const load = () => { if (CookieManager.getComplianceChoices().analytics) { - console.log("Track data") appInsights.loadAppInsights(); appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview - appInsights.trackEvent({name: 'Test event'}); } }; -const appInsights = new ApplicationInsights({ +export const appInsights = new ApplicationInsights({ config: { connectionString: 'InstrumentationKey=9ff70ae9-1397-4b70-85f2-2d3e80a29113;IngestionEndpoint=https://northeurope-2.in.applicationinsights.azure.com/;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/', diff --git a/src/pages/training/TrainingPage.svelte b/src/pages/training/TrainingPage.svelte index 2f11c7302..b45a9ecba 100644 --- a/src/pages/training/TrainingPage.svelte +++ b/src/pages/training/TrainingPage.svelte @@ -26,6 +26,7 @@ import { LossTrainingIteration } from '../../components/graphs/LossGraphUtil'; import StaticConfiguration from '../../StaticConfiguration'; import CookieManager from '../../script/CookieManager'; + import { appInsights } from '../../appInsights'; const model = classifier.getModel(); @@ -50,6 +51,17 @@ return newLoss; }); }; + + const trackModelEvent = () => { + if (CookieManager.getComplianceChoices().analytics) { + appInsights.trackEvent({ + name: 'ModelTrained', + properties: { + modelType: $selectedModelOption.id, + }, + }); + } + }; @@ -93,7 +105,7 @@
{resetLoss(); trackModelEvent();}} onTrainingIteration={trainingIterationHandler} />
{/if}