Socket
Socket
Sign inDemoInstall

app-usage-events-react

Package Overview
Dependencies
42
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    app-usage-events-react

A set of types, type checks, and type guards for simpler, safer, and easier to read code.


Version published
Weekly downloads
1
decreased by-99.35%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.1.14 (2024-04-20)

Bug Fixes

  • emit: re-attempt emission tasks in attempted state (0dcf206)

Readme

Source

app-usage-events-react

utility to easily emit app-usage-events from your app to the mhetrics platform

install

npm install @mhetrics/app-usage-events-react

use

autocaptured events

Add the provider to your react app. This provider is responsible for

  • instantiating the autocapture listeners
  • emitting the app-usage-events
  • configuring the capture-server authorization
import { AppUsageEventsEmitter } from '@mhetrics/app-usage-events-react';

<AppUsageEventsEmitter
  clientKey={config.mhetrics.clientKey}
  captureHost={config.mhetrics.captureHost}
/>

With that, your app will automatically be emitting

  • network events (e.g., rest requests)
  • browser events (e.g., load, unload, focus, blur, navigation)
  • runtime events (e.g., console.log, console.warn, console.error)
  • activity events (e.g., mouse, touch, scroll, keyboard)

observation events

Your app is now also configured to emit observation events. Observation events are produced by your application to track observations useful for analytics. Here is an example of how to emit observation events

import { captureObservationEvent } from '@mhetrics/app-usage-events-react';

await captureObservationEvent({
  /**
   * the type of the observation you are reporting
   */
  type: 'experiment.exposure', // for example, tracking that a user was exposed to an experiment

  /**
   * details about the observation
   */
  details: {
    experiment: 'show-reviews?', // for example, an experiment about whether or not reviews should be shown
    treatment: 'CONTROL', // for example, tracking that they were exposed to the CONTROL treatment of the experiment
  }
})

Keywords

FAQs

Last updated on 20 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc