Viewing portal telemetry using Application Insights

Loading

Application Insights is a powerful feature in Azure Monitor that allows you to collect detailed telemetry data from your Power Pages site. It helps track portal usage, performance, errors, page views, user sessions, and custom events. By integrating Application Insights with Power Pages, you gain rich observability into how your portal behaves and how users interact with it.


Table of Contents

  1. What is Application Insights?
  2. Benefits of Using Application Insights in Power Pages
  3. Prerequisites
  4. Step-by-Step Integration
  5. Viewing Telemetry Data
  6. Common Telemetry Scenarios
  7. Custom Events and Metrics
  8. Troubleshooting and Best Practices
  9. Summary
  10. Tags

1. What is Application Insights?

Application Insights (App Insights) is a service within Azure Monitor that provides powerful telemetry and logging capabilities. It can automatically track:

  • Page views
  • Performance metrics
  • Failures and exceptions
  • Custom user events
  • Backend dependencies (like APIs)

2. Benefits of Using App Insights in Power Pages

  • Real-time monitoring of how users interact with the portal
  • Detect issues like performance slowdowns, failed form submissions, or broken links
  • Track user session paths
  • Analyze usage patterns and popular content
  • Measure load times and API response delays
  • Set up alerts for specific behaviors

3. Prerequisites

To use Application Insights with Power Pages, you need:

  • A Power Pages site (formerly Power Apps Portal)
  • An active Azure subscription
  • Application Insights resource created in Azure
  • Admin access to the Power Platform and Azure

4. Step-by-Step Integration

Step 1: Create Application Insights Resource

  1. Go to Azure Portal
  2. Click Create a resourceApplication Insights
  3. Fill in:
    • Name: MyPowerPagesTelemetry
    • Application Type: General
    • Resource Group: Choose or create one
  4. Click Review + Create and then Create

Once created, note down the Instrumentation Key or Connection String


Step 2: Add App Insights to Power Pages

  1. Go to Power Pages Admin Center
  2. Select your site → Go to Site Settings
  3. Create a new Site Setting:
    • Name: ApplicationInsights.InstrumentationKey
    • Type: String
    • Value: Paste your Instrumentation Key here
    OR
    • Name: ApplicationInsights.ConnectionString
    • Value: Your Connection String (preferred method)
  4. Save the changes and restart the portal if needed

5. Viewing Telemetry Data

After a few minutes, data starts flowing into your Application Insights resource.

Navigate to:

Azure PortalApplication Insights → Choose your resource

Key sections:

  • Live Metrics: Real-time data of requests, users, and failures
  • Users: Track user sessions, countries, and behaviors
  • Sessions: See how long users stay and what pages they visit
  • Failures: Exceptions, dependency errors, and failed AJAX calls
  • Performance: Page load times, server response delays
  • Events: Page views, custom events, and button clicks
  • Availability: Set up tests to monitor uptime

6. Common Telemetry Scenarios

ScenarioFeature to Use
High load timesPerformance → Page Load Time
API errorsFailures → Exceptions
User pathsUsers → Session Timeline
Portal not loadingLive Metrics / Failures
Which pages are most popular?Events → PageViews

7. Tracking Custom Events and Metrics

You can extend telemetry by adding custom logging to your portal using JavaScript.

Example: Track Button Clicks

if (window.appInsights) {
document.getElementById("submit-btn").addEventListener("click", function() {
appInsights.trackEvent({ name: "SubmitButtonClicked" });
});
}

Other APIs:

  • trackException()
  • trackTrace()
  • trackMetric()
  • trackPageView()

These help you build advanced analytics dashboards using Kusto Query Language (KQL).


8. Troubleshooting and Best Practices

Data Not Appearing?

  • Check if the instrumentation key is correct
  • Ensure portal is live and traffic is hitting it
  • Use browser DevTools to inspect if ai.js is loaded
  • Use Network tab to see telemetry events being sent

Best Practices

  • Avoid sending sensitive data
  • Use sampling for high-traffic portals
  • Set up alerts on:
    • Load time > X seconds
    • Failures per minute
    • User drop-off rate

Leave a Reply

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