Application Insight to get Popular Pages even if Multiple ids in URL

Application Insight is very powerful system that let you collect telemetry on your website. It’s a service on Azure, which is currently free with the limitation to keep data for 7 days and aggregated data for 90 days.

One interesting thing you can do, without having to configure anything else than using Application Insight with your website, is to query the pageViews table. It allows you to get information about each page requested by user. However, if you are using an application you may have url with ID. For example The problem is that you will get result with noise. The same page has variables in the url. A simple fix is to replace any integer. Here is a code you can use on your own data which replace integer with a ‘x’ character.

 | extend replaced_operation_ParentName = replace(@'(\d+)', @'x', operation_Name)
 | where timestamp >= ago(7d) 
 | summarize c = count(replaced_operation_ParentName) by replaced_operation_ParentName
 | where c > 1
 | order by c desc 

The result look like this:


This is pretty fast, with less than 1 sec I got all the result. If you are not using integer in your url, but Guid, you can change the Regex to replace the pattern of a Guid.

If you like my article, think to buy my annual book, professionally edited by a proofreader. directly from me or on Amazon. I also wrote a TypeScript book called Holistic TypeScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.