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

@getforty/widget

v1.1.5

Published

Embeddable feedback widget and event tracking SDK for GetForty

Readme

@getforty/widget

Embeddable feedback widget and event tracking SDK for GetForty.

Installation

npm install @getforty/widget

Or include via CDN:

<script src="https://unpkg.com/@getforty/widget@latest/dist/index.global.js"></script>

Quick Start

ES Module

import { GetForty } from "@getforty/widget";

const widget = await GetForty.init({
  trackingId: "gf_xxxxxxxxxxxx", // Your workspace tracking ID
});

// Track events
widget.track("page_view", { page: "/pricing" });

// Identify users
widget.identify("user_123", { email: "[email protected]", plan: "pro" });

// Show feedback form
widget.showForm("my-feedback-form");

Script Tag

<script src="https://unpkg.com/@getforty/widget@latest/dist/index.global.js"></script>
<script>
  GetFortyWidget.GetForty.init({
    trackingId: "gf_xxxxxxxxxxxx",
  }).then(function (widget) {
    widget.track("page_view");
  });
</script>

Configuration

const widget = await GetForty.init({
  // Required
  trackingId: "gf_xxxxxxxxxxxx",

  // Optional - Form display
  mode: "modal", // 'modal' or 'inline'
  container: "#widget-container", // Container for inline mode

  // Optional - Appearance
  showBranding: true, // Show "Powered by GetForty"
  theme: {
    primaryColor: "#6366f1",
    backgroundColor: "#ffffff",
    textColor: "#1f2937",
    fontFamily: "Inter, sans-serif",
    borderRadius: "8px",
  },

  // Optional - Localization
  locale: "en", // 'en' or 'pt-BR'
  translations: {
    // Custom strings
    submit: "Send Feedback",
    success: "Thanks for your feedback!",
  },

  // Optional - Tracking
  autoTrackPageViews: true, // Auto-track page views

  // Optional - Development
  debug: false, // Enable debug logging
  apiBaseUrl: "https://getforty.club", // API endpoint
});

API

GetForty.init(config)

Initialize the widget with your configuration. Returns a Promise that resolves to a widget instance.

widget.track(eventName, properties?)

Track a custom event.

widget.track("purchase", {
  product: "Pro Plan",
  amount: 99.99,
  currency: "USD",
});

widget.identify(userId, traits?)

Identify the current user. Call this when a user logs in.

widget.identify("user_123", {
  email: "[email protected]",
  name: "John Doe",
  plan: "pro",
});

widget.showForm(formId)

Display a feedback form programmatically.

widget.showForm("clxxxxxxxxxxxxxxxxx");

widget.hideForm()

Hide the currently displayed form.

widget.flush()

Immediately send any queued events.

await widget.flush();

widget.getSessionId()

Get the current session ID.

const sessionId = widget.getSessionId();

Events

Subscribe to widget lifecycle events:

// Form loading
widget.on("load:start", ({ formId }) => {
  console.log("Loading form:", formId);
});

widget.on("load:success", ({ form }) => {
  console.log("Form loaded:", form.title);
});

widget.on("load:error", ({ error, retryable }) => {
  console.error("Failed to load form:", error);
});

// Form submission
widget.on("submit:start", ({ answers }) => {
  console.log("Submitting...", answers);
});

widget.on("submit:success", ({ responseId }) => {
  console.log("Submitted! Response ID:", responseId);
});

widget.on("submit:error", ({ error, retryable }) => {
  console.error("Submission failed:", error);
});

// Modal/form visibility
widget.on("open", ({ mode }) => {
  console.log("Form opened in", mode, "mode");
});

widget.on("close", ({ reason }) => {
  console.log("Form closed:", reason); // 'user', 'submitted', or 'programmatic'
});

// Generic errors
widget.on("error", ({ type, message }) => {
  console.error(`${type} error:`, message);
});

Unsubscribe from events:

const handleSuccess = ({ responseId }) => {
  console.log("Submitted:", responseId);
};

widget.on("submit:success", handleSuccess);
widget.off("submit:success", handleSuccess);

Localization

Built-in support for English and Portuguese (Brazil):

const widget = await GetForty.init({
  trackingId: "gf_xxxxxxxxxxxx",
  locale: "pt-BR", // Use Portuguese
});

Custom translations:

const widget = await GetForty.init({
  trackingId: "gf_xxxxxxxxxxxx",
  locale: "en",
  translations: {
    submit: "Send",
    success: "Thanks!",
    required: "Please fill this in",
  },
});

Theming

Customize the widget appearance:

const widget = await GetForty.init({
  trackingId: "gf_xxxxxxxxxxxx",
  theme: {
    primaryColor: "#3b82f6", // Buttons, active states
    backgroundColor: "#f8fafc", // Widget background
    textColor: "#0f172a", // Text color
    fontFamily: "system-ui", // Font family
    borderRadius: "12px", // Border radius
  },
});

TypeScript Support

Full TypeScript support with exported types:

import type {
  WidgetConfig,
  WidgetTheme,
  WidgetEventMap,
  TrackEventOptions,
  FormConfig,
  Answer,
} from "@getforty/widget";

Browser Support

  • Chrome (last 2 versions)
  • Firefox (last 2 versions)
  • Safari (last 2 versions)
  • Edge (last 2 versions)

Bundle Size

  • ~25KB gzipped (includes Preact runtime)
  • Shadow DOM for style isolation
  • No external dependencies at runtime

License

MIT