-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR adds user telemetry to the website through the integration of AppInsights Changes include: - Added AppInsights config - Set essential cookie with uuid to track usage analytics
- Loading branch information
1 parent
69a755e
commit 1db6729
Showing
8 changed files
with
286 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*! | ||
* Copyright (c) Microsoft Corporation and contributors. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
// eslint-disable-next-line import/no-unresolved | ||
import siteConfig from "@generated/docusaurus.config"; | ||
import { ReactPlugin } from "@microsoft/applicationinsights-react-js"; | ||
import { ApplicationInsights } from "@microsoft/applicationinsights-web"; | ||
|
||
const reactPlugin = new ReactPlugin(); | ||
let appInsights: ApplicationInsights | undefined; | ||
|
||
if (siteConfig?.customFields?.INSTRUMENTATION_KEY === undefined) { | ||
console.warn("Instrumentation Key is missing. App Insights will not be initialized."); | ||
} | ||
|
||
// Only initialize Application Insights if not in local development. | ||
// Remove the condition if you want to run Application Insights locally. | ||
if (typeof window !== "undefined" && window.location.hostname !== "localhost") { | ||
appInsights = new ApplicationInsights({ | ||
config: { | ||
connectionString: `InstrumentationKey=${siteConfig?.customFields?.INSTRUMENTATION_KEY}`, | ||
enableAutoRouteTracking: true, | ||
enableDebug: true, | ||
extensions: [reactPlugin], | ||
}, | ||
}); | ||
appInsights.loadAppInsights(); | ||
} | ||
|
||
export default appInsights; |
Oops, something went wrong.