Created
August 9, 2017 22:00
-
-
Save chrisobriensp/a30d770133d56a5f6bd92d302b2e6daa to your computer and use it in GitHub Desktop.
Adds Azure App Insights to every page as part of an SPFx Application Customizer.
This file contains hidden or 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
export default class AppInsightsCustomizerApplicationCustomizer | |
extends BaseApplicationCustomizer<IAppInsightsCustomizerApplicationCustomizerProperties> { | |
@override | |
public onInit(): Promise<void> { | |
/* update with YOUR App Insights key: */ | |
let appInsightsKey: string = "bd755e10-2e26-4580-8d58-446c0dd329fe"; | |
AppInsights.downloadAndSetup({ instrumentationKey: appInsightsKey }); | |
// simple usage - all params will be derived.. | |
AppInsights.trackPageView(); | |
console.log(`OnInit: Called trackPageView().`); | |
return Promise.resolve<void>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment