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

@morfoos/sdk

v1.0.0

Published

Framework-agnostic Morfoos analytics client SDK

Readme

@morfoos/sdk

Framework-agnostic client SDK for Morfoos analytics. Decouples tracking from Next.js / React so any site can integrate with a single init + three track methods.

Install

npm install @morfoos/sdk

In this monorepo the package lives at packages/morfoos-sdk. Host apps must expose the track API routes (POST /api/track/page-view, /api/track/event, /api/track/conversion).

Quick start

import { morfoos } from "@morfoos/sdk";

morfoos.init({
  siteId: "site_your_site",
  apiUrl: "https://yoursite.com",
});

// Automatic path from window.location if omitted
morfoos.trackPageView();

morfoos.trackEvent("cta_click", {
  path: "/pricing",
  data: { label: "Start trial" },
});

morfoos.trackConversion("contact_form_submit", {
  path: "/contact",
  entityId: "contact_main",
});

apiUrl is normalized to absolute track endpoints:

  • {apiUrl}/api/track/page-view
  • {apiUrl}/api/track/event
  • {apiUrl}/api/track/conversion

Override paths when needed:

morfoos.init({
  siteId: "site_your_site",
  apiUrl: "https://yoursite.com",
  endpoints: {
    pageView: "/api/track/page-view",
    event: "/api/track/event",
    conversion: "/api/track/conversion",
  },
});

Next.js (Morfoos OS)

Use @morfoos/morfoos-os for React providers and legacy helpers, or import the SDK directly:

"use client";
import { morfoos } from "@morfoos/sdk";
import { MorfoosAnalyticsProvider } from "@morfoos/morfoos-os/ui";

morfoos.init({
  siteId: process.env.NEXT_PUBLIC_SITE_ID!,
  apiUrl: process.env.NEXT_PUBLIC_SITE_URL!,
});

export function AnalyticsRoot({ children }) {
  return (
    <MorfoosAnalyticsProvider autoTrackClicks>
      {children}
    </MorfoosAnalyticsProvider>
  );
}

Legacy imports from @morfoos/morfoos-os/analytics/client delegate to the SDK and auto-init from NEXT_PUBLIC_SITE_ID / NEXT_PUBLIC_SITE_URL when morfoos.init() was not called yet.

Session identity

The SDK stores session_id in sessionStorage with a 30-minute inactivity window. Server responses may refresh the session id via sessionId in the JSON body.

Low-level send

morfoos.send(pipeline, payload, endpointOverride?) is available for framework adapters that need non-standard payloads (e.g. blog scroll metrics with kind: "blog_metric").

API

| Method | Description | |--------|-------------| | morfoos.init({ siteId, apiUrl, endpoints? }) | Required once before tracking | | morfoos.trackPageView(path?, endpoint?) | Page view pipeline | | morfoos.trackEvent(name, options?, endpoint?) | UI / chatbot events | | morfoos.trackConversion(typeOrEvent, options?, endpoint?) | Conversion pipeline | | morfoos.isInitialized() | Whether init ran | | morfoos.getConfig() | Current site id + resolved endpoints |