Welcome to the Application Insights for macOS documentation! This documentation will guide you on how to integrate and use Application Insights in your macOS application. Application Insights provides a comprehensive set of tools to monitor and analyze the performance and usage of your application, helping you make data-driven decisions to improve user experience.


Prior to integrating Application Insights in your macOS application, make sure you have the following:

  • macOS running version X or later
  • An Application Insights account
  • Basic knowledge of macOS development using Xcode


To start using Application Insights in your macOS application, follow these steps:

  1. Open your project in Xcode
  2. Navigate to the project settings
  3. Select your target application
  4. Go to the “Build Settings” tab
  5. Search for “Other Linker Flags” and add “-ObjC” flag
  6. Navigate to your project’s main target and select “Build Phases”
  7. In the “Link Binary with Libraries” phase, add the following frameworks:

    1. SystemConfiguration.framework
    2. WebKit.framework
    3. ApplicationInsights.framework
  8. Import the Application Insights library in your project
  9. Initialize the Application Insights service with your instrumentation key
  10. Start tracking events, exceptions, and other telemetry data


Application Insights offers various configuration options to tailor the telemetry collection based on your requirements. Here are the key configuration settings:

  • Instrumentation Key: The unique key that identifies your Application Insights resource.
  • Data Sampling Rate: The percentage of telemetry data to send to Application Insights.
  • Automatic Session Tracking: Enable or disable automatic tracking of user sessions.
  • Custom Event Properties: Add custom properties to events for advanced filtering and analysis.

To configure Application Insights, modify the appropriate settings in your AppDelegate.swift file.

AIConfiguration.shared().instrumentationKey = "YOUR_INSTRUMENTATION_KEY_HERE"
AIConfiguration.shared().samplingRate = 50.0
AIConfiguration.shared().enableAutoSessionManagement = true
AIConfiguration.shared().addCustomEventProperty("MyCustomProperty", withValue: "CustomValue")


Once Application Insights is integrated and configured, you can start tracking relevant telemetry data. Here are some common scenarios:

  • Event Tracking: Track important application events using the `trackEvent` method.
  • Exception Tracking: Report exceptions and errors using the `trackException` method.
  • Metrics Tracking: Measure custom metrics with the `trackMetric` method.
  • Page View Tracking: Monitor user interactions and navigation with the `trackPageView` method.


If you encounter any issues or errors while using Application Insights in your macOS application, please refer to the following troubleshooting tips:

  • Ensure you have correctly added the required frameworks and libraries.
  • Verify that you have provided the correct instrumentation key.
  • Check the console logs for any error messages related to Application Insights.
  • Visit the Application Insights forum for community support and assistance.


Congratulations! You have successfully integrated and configured Application Insights in your macOS application. Use the collected telemetry data to gain insights into your application’s performance and user behavior. If you have any further questions or need support, don’t hesitate to reach out to the Application Insights community.