-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added react hook for App Insights (#1574)
* added config for disabling cfg * revert comment * created hook to use app insights, removed code duplication * removed comment * added cfg config * added comment
- Loading branch information
1 parent
bd206cf
commit 23bb717
Showing
15 changed files
with
138 additions
and
233 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
import wrapPageElementWithTransition from './src/helpers/wrapPageElement.js'; | ||
import { ApplicationInsights } from '@microsoft/applicationinsights-web'; | ||
|
||
require('gatsby-remark-vscode/styles.css'); | ||
|
||
const appInsights = new ApplicationInsights({ | ||
config: { | ||
connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING, | ||
}, | ||
}); | ||
appInsights.loadAppInsights(); | ||
appInsights.addTelemetryInitializer((item) => { | ||
item.tags['ai.cloud.role'] = 'SSW.Rules-StaticClientPage'; | ||
}); | ||
appInsights.trackPageView(); // Manually call trackPageView to establish the current user/session/pageview | ||
export const onRouteUpdate = () => { | ||
if (window.appInsights && window.appInsights.trackPage) { | ||
window.appInsights.trackPage(); | ||
} | ||
}; | ||
|
||
// Page Transitions | ||
export const wrapPageElement = wrapPageElementWithTransition; |
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
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
Oops, something went wrong.