This is a tiny (1.2K zipped) script that improves Application Insights telemetry for single page apps written on jQuery Mobile framework. Application Insights already has SDK for JavaScript applications, you can read more about using Application Insights with JavaScript applications here. By default page views are only logged with physical page loads and main telemetry "buckets" (or "operations" in Application Insights speak) are associated with physical pages. For single page apps, often there's just a single physical page load and subsequent transitions are done by revealing the content already on the page. This script listens for JQM page transitions and sends trackPage events to AppInsights. Additionally it initializes new operation for every virtual page which helps with telemetry grouping.
##How to use it You can see a working example, directly loading the sample page from this repo: http://rawgit.com/AlexBulankou/ai-jqm/master/eg/sample1.html
This assumes you already have your Application Insights JavaScript snippet on the page, if not please follow the steps here.
Insert ai-jqm script after jQuery Mobile script and after Application Insights snippet. You can use cdn.rawgit.com and reference the latest tagged version: https://cdn.rawgit.com/AlexBulankou/ai-jqm/v0.9/scripts/ai-jqm.min.js
That's it - you're done! Try opening virtual pages of your JQM application and in your Application Insights resource you will see telemetry grouped according to JQM virtual page. For example, this is the telemetry I'm seeing for this application:
This allows you to easily view usage and loading performance for each of the JQM routes and, more importantly, you can view all telemetry that was logged for a particular route: