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

@livelayer/sdk

v0.7.6

Published

LiveLayer Agent Widget — drop-in web component for embedding LiveLayer agents

Readme

@livelayer/sdk

Drop-in web component and visitor tracker for embedding LiveLayer agents on any website.

Installation

npm install @livelayer/sdk

Usage

Script Tag (no bundler)

Add the widget to any HTML page:

<script type="module" src="https://unpkg.com/@livelayer/sdk"></script>
<livelayer-widget agent-id="your_agent_id"></livelayer-widget>

NPM Import

import "@livelayer/sdk";

// The <livelayer-widget> custom element is now registered.
// Use it in your HTML or create it programmatically:
const widget = document.createElement("livelayer-widget");
widget.setAttribute("agent-id", "your_agent_id");
document.body.appendChild(widget);

Structured data collection (0.7.0 — unified API)

Just write regular HTML forms. The widget auto-discovers every <form> on the page, paints values into the matching [name="..."] inputs as the agent records them, and fires one ll-collected event when the run is done:

<script src="https://unpkg.com/@livelayer/sdk" type="module"></script>
<livelayer-widget agent-id="agent_abc"></livelayer-widget>

<!-- Plain HTML — the agent finds this. -->
<form>
  <label>Email <input name="email" type="email" required /></label>
  <label>Company <input name="company" /></label>
  <button type="submit">Subscribe</button>
</form>

<script>
  document.querySelector("livelayer-widget").addEventListener(
    "ll-collected",
    (e) => {
      // Two phases: "field" (mid-flow update) and "complete" (final).
      if (e.detail.phase !== "complete") return;
      fetch("/api/leads", {
        method: "POST",
        body: JSON.stringify(e.detail.result),
      });
    },
  );
</script>

Opt out when you don't want a form / input visible to the agent:

<form data-ll-skip>...</form>           <!-- exclude the whole form -->
<input data-ll-private />               <!-- exclude one input -->
<form data-ll-intent="request a demo">  <!-- disambiguation hint -->

type="password", autocomplete="cc-*", and autocomplete="off" are ALWAYS excluded by the SDK — even if you accidentally named one of those inputs, the agent still can't fill it. See docs.livelayer.studio/develop/data-collection for the full result shape, dashboard-declared field lists, slide-level data collection, capability gating, and webhook delivery.

Visitor Tracker

Track page views, clicks, and custom events with automatic fingerprinting:

import { LiveLayerTracker } from "@livelayer/sdk";

const tracker = new LiveLayerTracker({
  agentId: "your_agent_id",
  autoTrack: true,        // auto-track page views (default: true)
  autoTrackClicks: true,  // auto-track interactive clicks (default: true)
});

await tracker.init();

// Identify a known visitor
tracker.identify({ name: "Jane", email: "[email protected]" });

// Track a custom event
tracker.track("demo_requested", { plan: "pro" });

Standalone script tag for the tracker:

<script
  src="https://unpkg.com/@livelayer/sdk/dist/tracker.js"
  data-agent-id="your_agent_id"
></script>
<script>
  // Available globally after init:
  LiveLayer.identify({ name: "Jane" });
  LiveLayer.track("signup");
</script>

Configuration

The <livelayer-widget> element accepts these attributes:

| Attribute | Description | | ----------- | ------------------------------------------------------------------------------ | | agent-id | Required. The published agent ID to connect to | | api-key | API key for cross-origin auth. Generate one at app.livelayer.studio/settings/api-keys. | | base-url | Override the API base URL (default auto-detects from script src) | | mode | Override experience mode: WIDGET or EMBEDDED |

Getting an API key

Cross-origin embedding (e.g., your marketing site embedding the widget) requires either a key or a configured domain allowlist. For a key:

  1. Go to app.livelayer.studio/settings/api-keys
  2. Click Create key, name it (e.g. Production), optionally set an expiry
  3. Copy the raw key from the one-time reveal banner — you can't retrieve it later
  4. Pass it to the widget as the api-key attribute
<livelayer-widget
  agent-id="agent_xxx"
  api-key="ll_abc..."
  base-url="https://app.livelayer.studio"
></livelayer-widget>

If the key is compromised or you rotate credentials, revoke it from the same dashboard — the server rejects it within ~30 seconds.

API

Classes

  • LiveLayerWidget -- The <livelayer-widget> custom element class.
  • LiveLayerTracker -- Visitor tracking with fingerprinting and event batching.

Functions

  • initFromScriptTag() -- Self-initializing entry point that reads config from data-* attributes on the current script tag.
  • saveSession(agentId, session) / loadSession(agentId) / clearSession(agentId) -- Session persistence helpers.
  • dispatchAgentEvent(detail) / parseDataChannelMessage(msg) / sanitize(html) -- Event bridge utilities.

Types

  • TrackerConfig -- Configuration for LiveLayerTracker (agentId, apiBase, autoTrack, autoTrackClicks).
  • VisitorInfo -- Resolved visitor info (id, isReturning, sessionCount).

License

MIT