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

@searchmindai/event-tracking-sdk

v1.0.2

Published

TypeScript SDK for tracking SearchMindAI search, chat, and commerce events, with a browser IIFE bundle.

Readme

@searchmindai/event-tracking-sdk

TypeScript SDK for tracking SearchMindAI events. Wraps @searchmindai/event-tracking-commons and provides typed functions for all event types.

Auto-fills common fields on every event: session_id, user_id, event_id, url, ts, referrer, device_type, and session attribution (attribution_source, attributed_search_id, attributed_chat_id).

Build

npm install

# Build ESM library + browser bundle
npm run build

# Build ESM library only
npm run build:lib

# Build browser bundle only (minified)
npm run build:browser

# Build browser bundle with sourcemaps
npm run build:browser:dev

Output:

  • dist/index.js — ESM library
  • dist/searchmindai.js — browser IIFE bundle (window.searchmindai)

test sdk locally

npm run build   # build dist/searchmindai.js first
npm run serve   # serves . at http://localhost:9080
  • open http://localhost:9080/test-html/index.html
  • note: port 9080 can vary, see console output
  • to test against local server, you need to use ngrok in the server for https

Usage as a library (npm install)

Install

npm install @searchmindai/event-tracking-sdk

Initialize

Call sdk.init() once at app startup before tracking any events:

import { sdk } from '@searchmindai/event-tracking-sdk';

sdk.init({
  store_api_key: 'your-api-key',
  apiBase: 'https://api.searchmindai.com',
});

Track a search event

import { sdk } from '@searchmindai/event-tracking-sdk';

sdk.trackSearch({
  query: 'blue running shoes',
  result_count: 24,
  search_mode: 'semantic',
  best_score: 0.94,
  suggested_product_ids: ['prod_1', 'prod_2', 'prod_3'],
  suggested_product_scores: [0.94, 0.91, 0.88],
});

Available tracking functions

sdk.trackSearch({ query, result_count?, best_score?, filter_expr?, search_mode?, suggested_product_ids?, suggested_product_scores? });
sdk.trackSearchResultClick({ product_id, product_name?, price?, position?, query? });
sdk.trackChatMessage({ chat_message_id, query, question_type?, total_time_ms?, ref_count?, suggested_product_ids?, rating? });
sdk.trackChatResultClick({ product_id, product_name?, price?, position?, chat_message_id? });
sdk.trackProductView({ product_id, product_name?, price? });
sdk.trackAddToCart({ product_id, product_name?, price?, quantity? });
sdk.trackRemoveFromCart({ product_id, price?, quantity? });
sdk.trackBeginCheckout({ cart_value?, cart_item_count?, order_product_ids? });
sdk.trackPurchase({ order_id, revenue, cart_item_count?, order_product_ids?, order_product_revenues? });

Usage in the browser

The npm package ships the ESM library only (dist/index.js); the minified browser IIFE bundle (dist/searchmindai.js) is a separate build artifact for direct <script> inclusion (e.g. hosted on a CDN or your own bucket), not published to npm. Build it yourself with npm run build:browser and host the resulting file, then include it directly in your HTML. It exposes a global searchmindai object.

<script src="https://your-cdn.com/searchmindai.js"></script>
<script>
  searchmindai.init({
    store_api_key: 'your-api-key',
    apiBase: 'https://api.searchmindai.com',
  });

  searchmindai.trackSearch({
    query: 'blue running shoes',
    result_count: 24,
    search_mode: 'semantic',
    suggested_product_ids: ['prod_1', 'prod_2', 'prod_3'],
  });
</script>

All tracking functions are available on the global searchmindai object:

searchmindai.trackProductView({ product_id: 'prod_1', product_name: 'Blue Runners', price: 89.99 });
searchmindai.trackAddToCart({ product_id: 'prod_1', product_name: 'Blue Runners', price: 89.99, quantity: 1 });
searchmindai.trackPurchase({ order_id: 'ord_123', revenue: 89.99, order_product_ids: ['prod_1'] });

License

MIT