diff --git a/web/package.json b/web/package.json index fb98509c..817e30ca 100644 --- a/web/package.json +++ b/web/package.json @@ -35,7 +35,9 @@ "type": "module", "dependencies": { "@lottiefiles/svelte-lottie-player": "^0.3.1", + "@microsoft/applicationinsights-web": "^3.3.1", "@tailwindcss/typography": "^0.5.13", + "dotenv": "^16.4.5", "highlight.js": "^11.10.0", "isomorphic-dompurify": "^2.14.0", "showdown": "^2.1.0", diff --git a/web/src/lib/components/CreateAgentDialog.svelte b/web/src/lib/components/CreateAgentDialog.svelte index f9ad7a5a..8ce6b99a 100644 --- a/web/src/lib/components/CreateAgentDialog.svelte +++ b/web/src/lib/components/CreateAgentDialog.svelte @@ -4,7 +4,8 @@ import { goto } from "$app/navigation"; import { toastStore } from "$lib/stores/ToastStores"; import { ToastType } from "$lib/types/Toast"; - import IconClose from "~icons/carbon/close"; + import appInsights from "$lib/utils/appInsights"; // Import the appInsights instance + import IconClose from "~icons/carbon/close"; import CarbonSearch from "~icons/carbon/search"; import CarbonGithub from "~icons/carbon/logo-github"; @@ -26,6 +27,14 @@ const onCreateAgent = () => { if (validateGithubURL(value)) { + // Track custom event for form submission + appInsights.trackEvent({ + name: "CreateAgentSubmitted", + properties: { + githubUrl: value, + }, + }); + goto(`${base}/agent?github=${value}`); } else { toastStore.set({ @@ -34,6 +43,13 @@ }); } }; + + $: if (showModal) { + // Track custom event for dialog opened + appInsights.trackEvent({ + name: "CreateAgentDialogOpened", + }); + } {#if showModal} @@ -48,11 +64,11 @@ >
+ class="flex items-center px-2.5 py-1 text-sm text-white" + on:click={onClose} + > + +

Create Agent with Github

-{/if} +{/if} \ No newline at end of file diff --git a/web/src/lib/components/chat/ChatIntroduction.svelte b/web/src/lib/components/chat/ChatIntroduction.svelte index 621c484d..b1d50854 100644 --- a/web/src/lib/components/chat/ChatIntroduction.svelte +++ b/web/src/lib/components/chat/ChatIntroduction.svelte @@ -1,6 +1,7 @@
@@ -96,6 +127,7 @@ href="https://marketplace.visualstudio.com/items?itemName=WelltestedAI.fluttergpt" target="_blank" class="flex items-center justify-center w-full md:w-auto h-12 px-6 font-medium text-white transition-colors duration-150 ease-in-out bg-blue-800 rounded-md hover:bg-blue-700 space-x-2 shadow-lg" + on:click={trackLinkClick} >
VSCode
@@ -145,7 +177,8 @@ {#each questionnaires as questionnaire} {/each} diff --git a/web/src/lib/components/chat/ChatMessage.svelte b/web/src/lib/components/chat/ChatMessage.svelte index b0aea399..8d0e8638 100644 --- a/web/src/lib/components/chat/ChatMessage.svelte +++ b/web/src/lib/components/chat/ChatMessage.svelte @@ -2,7 +2,7 @@ import showdown from "showdown"; import hljs from "highlight.js"; import DOMPurify from "isomorphic-dompurify"; - + import appInsights from "$lib/utils/appInsights"; import { writable } from "svelte/store"; import Icon from "@iconify/svelte"; import IconVisualStudio from "../icons/IconVisualStudio.svelte"; @@ -180,6 +180,13 @@ }, ]; }; + + const trackLinkClick = () => { + appInsights.trackEvent({ + name: 'VSCodeLinkClicked', + + }); + } {#each messages as message, index} @@ -266,6 +273,7 @@ href="https://marketplace.visualstudio.com/items?itemName=WelltestedAI.fluttergpt" target="_blank" class="flex items-center justify-center w-full md:w-auto h-12 px-6 font-medium text-white transition-colors duration-150 ease-in-out bg-blue-800 rounded-md hover:bg-blue-700 space-x-2 shadow-lg" + on:click={trackLinkClick} >
VSCode
diff --git a/web/src/lib/components/chat/ChatWindow.svelte b/web/src/lib/components/chat/ChatWindow.svelte index b9f4b420..453f4a6b 100644 --- a/web/src/lib/components/chat/ChatWindow.svelte +++ b/web/src/lib/components/chat/ChatWindow.svelte @@ -1,5 +1,6 @@ @@ -55,9 +70,7 @@ {#if loading} {:else if !loading && !currentAgentDetails} -
+

Error:

{errorMessage}