Start monitoring your website
With Azure Monitor Application Insights, you can easily monitor your website for availability, performance, and usage. You can also quickly identify and diagnose errors in your application without waiting for a user to report them. Application Insights provides both server-side monitoring as well as client/browser-side monitoring capabilities.
To complete this quickstart:
- You need an Azure Subscription.
If you don't have an Azure subscription, create a free account before you begin.
Sign in to the Azure portal
Sign in to the Azure portal.
Enable Application Insights
Application Insights can gather telemetry data from any internet-connected application, running on-premises or in the cloud. Use the following steps to start viewing this data.
Select Create a resource > Management tools > Application Insights.
If this is your first time creating an Application Insights resource you can learn more by visiting the Create an Application Insights Resource article.
A configuration box appears; use the following table to fill out the input fields.
Settings Value Description Name Globally Unique Value Name that identifies the app you are monitoring Resource Group myResourceGroup Name for the new resource group to host App Insights data. You can create a new resource group or use an existing one. Location East US Choose a location near you, or near where your app is hosted
Create an HTML file
On your local computer, create a file called
hello_world.html. For this example the file will be placed on the root of the C: drive at
Copy the script below into
Configure App Insights SDK
Select Overview > Essentials > Copy your application's Instrumentation Key.
Add the following script to your
hello_world.htmlbefore the closing
hello_world.htmland add your instrumentation key.
hello_world.htmlin a local browser session. This will create a single pageview. You can refresh your browser to generate multiple test page views.
Start monitoring in the Azure portal
Click on Analytics. This opens Analytics, which provides a rich query language for analyzing all data collected by Application Insights. To view data related to the client-side browser requests run the following query:
// average pageView duration by name let timeGrain=1s; let dataset=pageViews // additional filters can be applied here | where timestamp > ago(15m) | where client_Type == "Browser" ; // calculate average pageView duration for all pageViews dataset | summarize avg(duration) by bin(timestamp, timeGrain) | extend pageView='Overall' // render result in a chart | render timechart
Go back to the Overview page. Click on Browser from under the Investigate header, then select Performance Here you find metrics related to the performance of your website. There is also a corresponding view for analyzing failures and exceptions in your website. You can click Samples to drill into individual transaction details. From here, you can access the end-to-end transaction details experience.
To begin exploring the user behavior analytics tools, from the main Application Insights menu select Users under the Usage header. Since we are testing from a single machine, we will only see data for one user. For a live website, the distribution of users might look as follows:
If we had instrumented a more complex website with multiple pages, another useful tool is User Flows. With User Flows you can track the pathway visitors takes through the various parts of your website.
Clean up resources
If you plan to continue on to work with subsequent quickstarts or with the tutorials, do not clean up the resources created in this quickstart. Otherwise, if you do not plan to continue, use the following steps to delete all resources created by this quickstart in the Azure portal.
If you used an existing resource group the instructions below will not work and you will need to just delete the individual Application Insights resource. Keep in mind anytime you delete a resource group all underyling resources that are members of that group will be deleted.
- From the left-hand menu in the Azure portal, click Resource groups and then click myResourceGroup.
- On your resource group page, click Delete, type myResourceGroup in the text box, and then click Delete.