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

sender-forms

v1.1.1

Published

Nuxt 3 module for Sender.net form integration

Downloads

89

Readme

sender-forms

npm version npm downloads License Nuxt

Sender.net integration for Nuxt 3/4 and Vue 3. Injects the Sender universal script into your app and provides a <SenderForm> component so you can render embedded signup forms without copying embed snippets by hand.


Which package do I need?

| Framework | Installation | Setup | |---|---|---| | Nuxt 3 / Nuxt 4 | npm install sender-forms | modules: ['sender-forms'] in nuxt.config.ts | | Vue 3 (Vite, etc.) | npm install sender-forms | app.use(SenderFormsPlugin, { accountId }) in main.ts |

Both ship from the same package — Nuxt users import the default module, Vue users import from sender-forms/vue.


Features

  • Injects the Sender.net universal JavaScript snippet into <head> on every page
  • Auto-registers <SenderForm> globally — no manual import needed
  • Works with popup forms (script-only) and embedded forms (script + component)
  • TypeScript-friendly options for both Nuxt and Vue
  • Optional enabled flag — handy for disabling in local or preview environments
  • SSR-safe Vue plugin (guards against document access on the server)

Installation

# npm
npm install sender-forms

# pnpm
pnpm add sender-forms

# yarn
yarn add sender-forms

Nuxt Setup

Register the module

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['sender-forms'],

  senderForms: {
    accountId: 'your-account-public-id',
  },
})

That's it. The script is injected into <head> on every page and <SenderForm> is available everywhere with no imports.

With environment variable (recommended)

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['sender-forms'],

  senderForms: {
    accountId: process.env.NUXT_SENDER_ACCOUNT_ID || '',
  },
})
# .env
NUXT_SENDER_ACCOUNT_ID=XXXXXXXXXXXXX

Disable in non-production environments

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['sender-forms'],

  senderForms: {
    accountId: process.env.NUXT_SENDER_ACCOUNT_ID || '',
    enabled: process.env.NODE_ENV === 'production',
  },
})

Vue 3 Setup

Import the plugin from the /vue subpath and register it with app.use().

// main.ts
import { createApp } from 'vue'
import App from './App.vue'
import { SenderFormsPlugin } from 'sender-forms/vue'

const app = createApp(App)

app.use(SenderFormsPlugin, {
  accountId: 'XXXXXXXXXXXXX',
})

app.mount('#app')

<SenderForm> is registered globally — use it in any component without importing it.

With Vite environment variable

// main.ts
app.use(SenderFormsPlugin, {
  accountId: import.meta.env.VITE_SENDER_ACCOUNT_ID || '',
})
# .env
VITE_SENDER_ACCOUNT_ID=XXXXXXXXXXXXX

Disable in development

app.use(SenderFormsPlugin, {
  accountId: import.meta.env.VITE_SENDER_ACCOUNT_ID || '',
  enabled: import.meta.env.PROD,
})

Usage

Embedded forms

Embedded forms need two things: the universal script (handled automatically) and a mount point where the form renders. Use <SenderForm> wherever you want the form to appear:

<template>
  <section>
    <h2>Subscribe to our newsletter</h2>
    <SenderForm form-id="aADzYP" />
  </section>
</template>

The component renders:

<div style="text-align: left" class="sender-form-field" data-sender-form-id="aADzYP"></div>

This is the exact markup from Sender's own embed snippet — the universal script finds it and fills in the form.

Multiple forms on one page? Just drop <SenderForm> in multiple places with different form-id values.

<template>
  <div>
    <SenderForm form-id="aADzYP" />   <!-- footer form -->
    <SenderForm form-id="bBEzZQ" />   <!-- sidebar form -->
  </div>
</template>

Popup forms

Popup forms only need the universal script in <head> — Sender handles the rest automatically. Configure the module/plugin with your accountId and you're done. No <SenderForm> needed.


Finding your IDs

Account public ID

This is the ID passed to sender('YOUR_ID') in the universal script.

  1. Log in to Sender.net
  2. Go to SettingsAPI access tokens
  3. Copy your Account public ID

Form ID

This is the data-sender-form-id value from the embed snippet.

  1. In Sender, go to Forms and open your embedded form
  2. Open the Publishing or Embed tab
  3. Find the embed snippet — the form ID is the value of data-sender-form-id:
    <div ... data-sender-form-id="aADzYP"></div>
    <!--                          ^^^^^^ this part -->

API Reference

Nuxt module options (senderForms)

| Option | Type | Default | Description | |---|---|---|---| | accountId | string | '' | Sender Account public ID. Required — module skips setup if empty. | | enabled | boolean | true | Set to false to disable script injection and component registration entirely. |

Vue plugin options (SenderFormsPlugin)

| Option | Type | Default | Description | |---|---|---|---| | accountId | string | — | Sender Account public ID. Required — plugin skips setup if empty. | | enabled | boolean | true | Set to false to disable script injection and component registration entirely. |

<SenderForm> component

| Prop | Type | Required | Description | |---|---|---|---| | formId | string | ✅ Yes | Embedded form ID from Sender. Use form-id in templates. |

Registered globally by both the Nuxt module and the Vue plugin — no import needed in your components.


How it works

nuxt.config / app.use()
       │
       ▼
  accountId provided?
  enabled !== false?
       │
       ├── YES → inject <script> into <head>
       │              calls sender('your-account-id')
       │              loads cdn.sender.net/universal.js
       │
       └── register <SenderForm> component globally
                 │
                 ▼
           <div class="sender-form-field"
                data-sender-form-id="...">
                 │
                 ▼
         Sender script fills in the form

Nuxt: script is appended at build time via nuxt.options.app.head.script.

Vue: script is injected at runtime via document.createElement('script') inside install(), with an typeof document !== 'undefined' guard for SSR environments.


Troubleshooting

Form not appearing?

  • Check the browser console for errors from cdn.sender.net
  • Confirm accountId is set correctly — check Settings → API access tokens in Sender
  • Confirm form-id on <SenderForm> matches the data-sender-form-id in your Sender embed snippet
  • If using enabled, make sure it evaluates to true in your current environment

Script injected but popup not triggering?

  • Popup forms are fully managed by Sender's script. Verify your popup is published and active in the Sender dashboard.

Vue + SSR: script not loading?

  • The Vue plugin only injects the script in browser environments. If you need SSR head injection, consider using the @unhead/vue package to add the script tag from within a component's onMounted hook.

Resources


Development

# Install dependencies
pnpm install

# Generate type stubs
pnpm run dev:prepare

# Develop with the playground (Nuxt)
pnpm run dev

# Build the playground
pnpm run dev:build

# Run ESLint
pnpm run lint

# Run tests
pnpm run test
pnpm run test:watch

# Release new version
pnpm run release

Configure the playground in playground/nuxt.config.ts with a test accountId, then use <SenderForm form-id="..." /> in playground/app.vue.

To test the Vue plugin separately, create a plain Vite + Vue 3 app and import from sender-forms/vue.


License

MIT