Salesforce, Python, SQL, & other ways to put your data where you need it

Need event music? 🎸

Live and recorded jazz, pop, and meditative music for your virtual conference / Zoom wedding / yoga class / private party with quality sound and a smooth technical experience

💬 EN

#


So I don’t have to do a lot of coding using the SDK? Just import the SDK library, flip on 1 setting app-wide, and let it sit around and listen

While the Application Insights SDK does offer some automatic data collection with minimal setup, it’s not quite as simple as just importing the library and flipping one switch. Here’s a more accurate picture:

  1. You do need to add the Application Insights SDK to your application. This typically involves installing a package and adding some initialization code1.
  2. For basic telemetry, you’ll need to configure the SDK with your Application Insights resource’s connection string or instrumentation key1.
  3. Some features, like tracking page visit time, can be enabled by setting a single configuration option. For example, setting autoTrackPageVisitTime: true will automatically track the time users spend on each page23.
  4. However, for more comprehensive monitoring, you’ll likely need to add some custom instrumentation:
    • Custom event tracking may require additional code2.
    • Tracking specific metrics or user behaviors often needs custom implementation4.
    • Advanced features like dependency tracking or custom sampling rates require additional configuration5.
  5. The level of automatic data collection depends on your application type and the SDK version you’re using. Web applications typically get more out-of-the-box tracking than other types of applications6.
  6. While the SDK does “sit around and listen” to some extent, you often need to actively instrument important parts of your code for the most valuable insights47.

In summary, while Application Insights does offer some automatic telemetry, getting the most value usually requires more than just importing the SDK and enabling a single setting. It’s designed to be relatively easy to implement, but some level of custom instrumentation is typically necessary for comprehensive monitoring67.


But things like user session duration will work with just app-wide config?

Yes, user session duration tracking can be enabled with minimal app-wide configuration in Azure Application Insights. By setting autoTrackPageVisitTime: true in your Application Insights configuration, you can automatically track the time users spend on each page89.

This setting works as follows:

  1. It tracks the time spent on the previous page when a new page view occurs.
  2. The data is sent as a custom metric named “PageVisitTime” in milliseconds10.
  3. It uses the Date.now() function if available, or falls back to (new Date()).getTime() for older browsers10.

However, it’s important to note:

  1. You still need to properly initialize the Application Insights SDK in your application with the correct instrumentation key or connection string9.
  2. While this provides basic session duration tracking, more complex session analytics might require additional configuration or custom event tracking1112.
  3. The default session timeout is 30 minutes of inactivity, but this can be customized using sessionRenewalMs and sessionExpirationMs settings1112.

Remember that while this app-wide configuration provides valuable data, getting the most comprehensive insights often requires some level of custom instrumentation beyond just the basic setup13.

  1. https://signoz.io/guides/azure-app-insights/  2

  2. https://stackoverflow.com/questions/45761999/azure-application-insights-to-track-time-spent-by-user-on-webpage  2

  3. https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-sdk-configuration 

  4. https://blog.trustedtechteam.com/2021-03-31-youve-heard-of-application-insights-right/  2

  5. https://www.reddit.com/r/AZURE/comments/18j00zy/exploring_the_app_insights_sdk/ 

  6. https://azuredevopslabs.com/labs/vsts/monitor/  2

  7. https://learn.microsoft.com/en-us/azure/azure-monitor/app/usage  2

  8. https://stackoverflow.com/questions/45761999/azure-application-insights-to-track-time-spent-by-user-on-webpage 

  9. https://search.r-project.org/CRAN/refmans/AzureAppInsights/html/config.html  2

  10. https://learn.microsoft.com/en-us/azure/azure-monitor/app/javascript-sdk-configuration  2

  11. https://github.com/Huachao/azure-content/blob/master/articles/application-insights/app-insights-web-track-usage.md  2

  12. https://www.patrickvankleef.com/2018/02/07/application-insights-user-telemetry-data-send-to-azure/  2

  13. https://github.com/microsoft/ApplicationInsights-Announcements/issues/10