diff --git a/src/appInsights.ts b/src/appInsights.ts index cc421f112..a2bdbccc4 100644 --- a/src/appInsights.ts +++ b/src/appInsights.ts @@ -13,7 +13,7 @@ const load = () => { appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview } }; -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 47cca7124..ec5e6e5de 100644 --- a/src/pages/training/TrainingPage.svelte +++ b/src/pages/training/TrainingPage.svelte @@ -21,6 +21,7 @@ import StaticConfiguration from '../../StaticConfiguration'; import CookieManager from '../../script/CookieManager'; import { stores } from '../../script/stores/Stores'; + import { appInsights } from '../../appInsights'; const classifier = stores.getClassifier(); const gestures = stores.getGestures(); @@ -46,6 +47,17 @@ return newLoss; }); }; + + const trackModelEvent = () => { + if (CookieManager.getComplianceChoices().analytics) { + appInsights.trackEvent({ + name: 'ModelTrained', + properties: { + modelType: $selectedModelOption.id, + }, + }); + } + }; @@ -89,7 +101,7 @@
{resetLoss(); trackModelEvent();}} onTrainingIteration={trainingIterationHandler} />
{/if}