🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

app-usage-events-emitter-react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-usage-events-emitter-react

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

1.0.1
latest
Source
npm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

app-usage-events-emitter-react

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

install

npm install @mhetrics/app-usage-events-emitter-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-emitter-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)

domain events

Your app is now also configured to emit domain events. Domain events are custom events produced by your application's domain logic (a.k.a. business logic). Here is an example of how to emit domain events

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

await emitDomainEvent({
  /**
   * the name of this event
   */
  name: 'conversion', // a conversion occurred

  /**
   * the scope of the domain that this event applies to
   */
  scope: 'storefront', // a conversion from the storefront product

  /**
   * any adhoc details we want to associate with this event
   */
  details: {
    promocode: 'WINT23',
  }
})

Keywords

types

FAQs

Package last updated on 16 Jul 2023

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