Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/applicationinsights-web

Package Overview
Dependencies
Maintainers
2
Versions
583
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/applicationinsights-web

Microsoft Application Insights JavaScript SDK - Web

  • 3.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
520K
decreased by-1.21%
Maintainers
2
Weekly downloads
 
Created

What is @microsoft/applicationinsights-web?

@microsoft/applicationinsights-web is a JavaScript library that provides a way to collect and send telemetry data from web applications to Azure Application Insights. It helps in monitoring the performance, usage, and errors of web applications.

What are @microsoft/applicationinsights-web's main functionalities?

Basic Setup

This code initializes the Application Insights instance with the provided instrumentation key and tracks a page view.

const { ApplicationInsights } = require('@microsoft/applicationinsights-web');
const appInsights = new ApplicationInsights({ config: {
  instrumentationKey: 'YOUR_INSTRUMENTATION_KEY'
} });
appInsights.loadAppInsights();
appInsights.trackPageView();

Custom Event Tracking

This code tracks a custom event with a name and additional properties.

appInsights.trackEvent({ name: 'myCustomEvent', properties: { customProperty: 'customValue' } });

Exception Tracking

This code tracks an exception that occurs within the application.

try {
  throw new Error('Test error');
} catch (e) {
  appInsights.trackException({ exception: e });
}

Dependency Tracking

This code tracks a dependency call, such as an HTTP request, with details like duration, success status, and result code.

appInsights.trackDependencyData({
  id: 'uniqueId',
  target: 'http://example.com',
  name: 'GET /example',
  duration: 300,
  success: true,
  resultCode: 200
});

User and Session Tracking

This code sets the authenticated user context, which helps in tracking user and session data.

appInsights.setAuthenticatedUserContext('userId', 'accountId');

Other packages similar to @microsoft/applicationinsights-web

FAQs

Package last updated on 30 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc