Previously i have explained how you can configure Azure App Insight in SharePoint Online classic mode.
As Microsoft driving towards SharePoint modern sites where it is not possible to edit Master Page to add your custom artefacts. However, you can still run custom scripts using different pnp provisoning engine templates etc.
In this post, I would like to show you following two scenarios
- How you can configure Azure Application Insight within SharePoint modern site using SPFX Application Customizer.
Here are wonderful tutorials available by microsoft Getting Started with SPFX Application Customizer
👉 npm install applicationinsights-js
- Make sure you have valid Azure App Insight key
- Create a custom property called ‘instrumentationKey’ and add valid Azure App Insight Key under serve.json file under config folder
👉 Here is code snippet
Happy SharePoint modernization!