npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mollie/ui-analytics

v2.11.1

Published

```bash # With Jitsu backend (web) yarn add @mollie/ui-analytics @jitsu/js

Downloads

1,492

Readme

@mollie/ui-analytics

Installation

# With Jitsu backend (web)
yarn add @mollie/ui-analytics @jitsu/js

# With Segment backend (React Native)
yarn add @mollie/ui-analytics @segment/analytics-react-native

The core manager works without any backend — @jitsu/js and @segment/analytics-react-native are optional peer dependencies.


Without React (Vanilla JS/TS)

1. Subscribe to events

import { analyticsManager } from '@mollie/ui-analytics';
import { createAnalyticsSubscriber } from '@mollie/ui-analytics/jitsu';

const [subscribeFn, analytics] = createAnalyticsSubscriber({
  writeKey: 'your-write-key:secret',
  host: 'https://your-jitsu-host.example.com',
  debug: true, // optional
  privacy: false, // optional — strips IPs and disables user IDs when true
});

const unsubscribe = analyticsManager.subscribe(subscribeFn);

2. Emit events

analyticsManager.emit('button_clicked', {
  journey_name: 'onboarding',
  current_screen: 'signup',
  interaction_type: 'click',
  element_type: 'button',
  element_details: 'submit-form',
});

3. Identify users and track pages

analytics.identify('user-123', { email: '[email protected]' });
analytics.page('home', { referrer: 'google' });
analytics.reset(); // clear identity on logout

4. Decorate events globally

Decorators enrich every event that passes through the manager:

const undecorate = analyticsManager.decorate((event) => ({
  ...event,
  platform: 'web',
  app_version: '2.1.0',
}));

// Later: undecorate() to remove

5. Cleanup

unsubscribe(); // remove one subscriber
analyticsManager.clear(); // remove all subscribers, decorators, and history

With React

1. Set up the provider

import { createAnalyticsSubscriber } from '@mollie/ui-analytics/jitsu';
import {
  AnalyticsSubscriber,
  useAnalyticsSubscriber,
} from '@mollie/ui-analytics/react';

function App() {
  const [subscribeFn] = useAnalyticsSubscriber(() =>
    createAnalyticsSubscriber({
      writeKey: process.env.JITSU_WRITE_KEY,
      host: process.env.JITSU_HOST,
    })
  );

  return (
    <AnalyticsSubscriber
      onEvent={subscribeFn}
      onDecorateEvent={(event) => ({
        ...event,
        platform: 'web',
      })}
    >
      <Routes />
    </AnalyticsSubscriber>
  );
}

AnalyticsSubscriber handles subscribing and unsubscribing internally — no useEffect needed.

2. Emit events from components

import { useAnalyticsEmitter } from '@mollie/ui-analytics/react';

function SignupButton() {
  const emit = useAnalyticsEmitter();

  return (
    <button
      onClick={() =>
        emit('signup_started', {
          journey_name: 'onboarding',
          current_screen: 'landing',
          interaction_type: 'click',
        })
      }
    >
      Sign up
    </button>
  );
}

3. Add contextual decorators

Nest AnalyticsDecorator components to automatically enrich events emitted by descendants:

import { AnalyticsDecorator } from '@mollie/ui-analytics/react';

function SettingsPage() {
  return (
    <AnalyticsDecorator
      onEvent={(event) => ({
        ...event,
        current_screen: 'settings',
        journey_name: 'account_management',
      })}
    >
      <ProfileSection />
      <BillingSection />
    </AnalyticsDecorator>
  );
}

Decorators compose — inner decorators run after outer ones.


Event structure

Emitted properties are automatically transformed into a structured event:

| Context | Fields | | ---------------------- | --------------------------------------------------------------------------------------- | | journeyContext | journey_name, current_screen, entry_source, journey_entry_id, previous_action | | interactionDetails | interaction_type, element_type, element_details, input_details, time_spend_ms | | failureContext | failure_reason, failure_type, recovery_action | | systemContext | client_timestamp, platform, feature_flags |

journey_entry_id (UUID) and client_timestamp are auto-generated. previous_action is tracked automatically per journey_name.

Available enums

import {
  ElementType, // BUTTON, INPUT, FORM, DROPDOWN
  EntrySource, // NAVBAR, DEEP_LINK, NOTIFICATION, EMAIL, EXTERNAL
  FailureType, // VALIDATION, SYSTEM, USER_ABANDONED, TIMEOUT
  InputType, // TEXT, SELECTION, UPLOAD, SUBMIT
  InteractionType, // CLICK, VIEW, ELEMENT_RENDERED, INPUT, SYSTEM, FORM_SUBMIT
  Platform, // WEB, MOBILE_WEB, IOS, ANDROID
} from '@mollie/ui-analytics';

React Native

Use the native import paths — the API is identical:

import { useAnalyticsEmitter } from '@mollie/ui-analytics/react/native';
import { createAnalyticsSubscriber } from '@mollie/ui-analytics/jitsu/native';

The native Jitsu subscriber uses @segment/analytics-react-native under the hood with a proxy pointing to your Jitsu host.