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

@agoodway/goodleads-astro

v0.1.0

Published

Astro integration for GoodLeads lead capture. Provides a drop-in `<QuizFunnel>` component and server-side route helpers for session recording — everything you need to add a lead capture quiz funnel to an Astro site.

Readme

@agoodway/goodleads-astro

Astro integration for GoodLeads lead capture. Provides a drop-in <QuizFunnel> component and server-side route helpers for session recording — everything you need to add a lead capture quiz funnel to an Astro site.

Installation

npm install @agoodway/goodleads-astro
# or
bun add @agoodway/goodleads-astro

Entry Points

| Import | Description | |--------|-------------| | @agoodway/goodleads-astro | QuizFunnel Astro component | | @agoodway/goodleads-astro/recording-routes | Server-side recording route builders |

Quick Start

1. Add the QuizFunnel Component

---
import QuizFunnel from "@agoodway/goodleads-astro";
---

<html>
  <body>
    <QuizFunnel
      accountSlug="acme-roofing"
      apiBaseUrl="https://api.goodleads.com"
    />
  </body>
</html>

That's it — the component includes all styles, scripts, and the quiz engine. It fetches the questionnaire from your GoodLeads account and renders the full multi-step funnel.

2. Component Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | accountSlug | string | Yes | Your GoodLeads account slug | | apiBaseUrl | string | Yes | GoodLeads API base URL | | questionnaireSlug | string | No | Specific questionnaire to load (defaults to account default) | | questionnaire | object | No | Pre-fetched questionnaire data (skips network fetch) | | campaignSlug | string | No | Campaign slug for attribution | | clientIpAddress | string | No | Client IP for server-rendered pages | | recordingSessionId | string | No | Enable session recording with this ID | | dev | boolean | No | Enable dev mode (bypasses phone verification) |

3. Add Session Recording Routes (Optional)

If you want session recording, add two API routes:

src/pages/api/recordings/start.ts

import { createStartRecordingRoute } from "@agoodway/goodleads-astro/recording-routes";

export const prerender = false;

export const POST = createStartRecordingRoute({
  goodAuditApiUrl: import.meta.env.GOODAUDIT_API_URL,
  goodAuditApiKey: import.meta.env.GOODAUDIT_API_KEY,
  goodleadsApiUrl: import.meta.env.GOODLEADS_API_URL,
  recordingCookieSecret: import.meta.env.GOODLEADS_RECORDING_COOKIE_SECRET,
});

src/pages/api/recordings/complete.ts

import { createCompleteRecordingRoute } from "@agoodway/goodleads-astro/recording-routes";

export const prerender = false;

export const POST = createCompleteRecordingRoute({
  goodAuditApiUrl: import.meta.env.GOODAUDIT_API_URL,
  goodAuditApiKey: import.meta.env.GOODAUDIT_API_KEY,
  goodleadsApiUrl: import.meta.env.GOODLEADS_API_URL,
  recordingCookieSecret: import.meta.env.GOODLEADS_RECORDING_COOKIE_SECRET,
});

4. Dynamic Configuration

Route config can be a function that receives the Astro API context:

export const POST = createStartRecordingRoute((context) => ({
  goodAuditApiUrl: context.locals.runtime.env.GOODAUDIT_API_URL,
  goodAuditApiKey: context.locals.runtime.env.GOODAUDIT_API_KEY,
  goodleadsApiUrl: context.locals.runtime.env.GOODLEADS_API_URL,
  recordingCookieSecret: context.locals.runtime.env.RECORDING_COOKIE_SECRET,
}));

This is useful for Cloudflare Workers, Vercel Edge, or other runtimes where env vars are accessed differently.

Environment Variables

| Variable | Description | |----------|-------------| | GOODAUDIT_API_URL | GoodAudit session recording API URL | | GOODAUDIT_API_KEY | GoodAudit API key | | GOODLEADS_API_URL | GoodLeads internal API URL (for lead session validation) | | GOODLEADS_RECORDING_COOKIE_SECRET | Secret for signing completion cookies |

Recording Route Configuration

| Option | Type | Required | Description | |--------|------|----------|-------------| | goodAuditApiUrl | string | Yes | GoodAudit API base URL | | goodAuditApiKey | string | Yes | GoodAudit API key | | goodleadsApiUrl | string | Yes | GoodLeads API base URL | | recordingCookieSecret | string | Yes | HMAC secret for cookie signing | | completionCookieName | string | No | Cookie name (default: gl_recording_complete) | | completionRoutePath | string | No | Cookie path (default: /api/recordings/complete) | | completionCookieTtlSeconds | number | No | Cookie TTL (default: 7200 / 2 hours) |

Styling

The component imports its own stylesheet wrapped in @layer goodleads. You can override styles using standard CSS specificity or by targeting the layer:

@layer goodleads {
  .quiz-funnel {
    --quiz-accent: #your-brand-color;
  }
}

See STYLING.md for the full list of class hooks, CSS variables, and override patterns.

How It Works

  1. The <QuizFunnel> component renders a loading skeleton
  2. On mount, it fetches the questionnaire from your GoodLeads account
  3. The quiz engine drives the user through conditional questions
  4. Answers are submitted to the Lead Collection API as the user progresses
  5. On completion, the lead is matched with a buyer and real-time features (video call, chat) activate
  6. If session recording is enabled, browser events are captured and uploaded to GoodAudit

Dependencies

  • @agoodway/goodleads-quiz-core — Quiz engine logic
  • @agoodway/goodleads-server — Server-side recording flow handlers
  • @agoodway/goodleads-web — Browser-side SDK (bundled into the component script)

Peer Dependencies

  • astro ^5.x

License

MIT