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

@microsoft/applicationinsights-react-js

Package Overview
Dependencies
Maintainers
2
Versions
410
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/applicationinsights-react-js

Microsoft Application Insights React plugin

  • 17.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
166K
decreased by-8.01%
Maintainers
2
Weekly downloads
 
Created

What is @microsoft/applicationinsights-react-js?

@microsoft/applicationinsights-react-js is a package that provides React-specific bindings for the Application Insights JavaScript SDK. It allows developers to easily integrate Azure Application Insights into their React applications for monitoring and telemetry purposes.

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

React Plugin Initialization

This code initializes the React plugin for Application Insights and configures it with the necessary instrumentation key and browser history.

const reactPlugin = new ReactPlugin();
const appInsights = new ApplicationInsights({
  config: {
    instrumentationKey: 'YOUR_INSTRUMENTATION_KEY',
    extensions: [reactPlugin],
    extensionConfig: {
      [reactPlugin.identifier]: { history: browserHistory }
    }
  }
});
appInsights.loadAppInsights();

Tracking React Component Renders

This code demonstrates how to wrap a React component with the `withAITracking` higher-order component to automatically track its renders.

import { withAITracking } from '@microsoft/applicationinsights-react-js';

class MyComponent extends React.Component {
  render() {
    return <div>My Component</div>;
  }
}

export default withAITracking(reactPlugin, MyComponent);

Custom Event Tracking

This code shows how to track custom events using the Application Insights instance.

appInsights.trackEvent({ name: 'customEvent', properties: { customProperty: 'value' } });

Other packages similar to @microsoft/applicationinsights-react-js

FAQs

Package last updated on 31 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