Add a waitlist form to your Next.js site in one component
LaunchSuite gives a Next.js site a signup form that writes every email into one contact list, sends each signup a confirmation email, and counts visitors and conversions. You add it with one small client component and one div, or with a plain iframe if you want the form rendered entirely on the server.
This guide covers both routes, the App Router details that catch people out (script strategy, client-side navigation and Content Security Policy), and what to check before you publish.
What gets in the way
- The embed script scans the page once
- embed.js looks for [data-launchsuite-waitlist] elements when it runs and then stops. It does not watch for elements added later. In Next.js, a page you reach with a Link after the script has already run in that tab can keep an empty box where the form should be.
- Script timing can clash with hydration
- A script that runs before React hydrates the page can add an iframe to the div while React is still matching the server markup. The afterInteractive strategy runs after hydration, which avoids the mismatch. Don't reach for beforeInteractive for a signup form.
- Server Components and client JavaScript
- Most of an App Router site can stay a Server Component. The script needs the browser, so it lives in a small client component. If you want zero client JavaScript for the form, skip the script and render the iframe straight from a Server Component.
- A strict Content Security Policy blocks the form silently
- If next.config sets a Content-Security-Policy header, script-src must allow https://launchsuite.co and frame-src must allow it too. Otherwise the form never appears, and the browser console names the blocked URL, which is the first place to look.
- Unpublished projects show nothing useful
- The embed route returns a not-found page for projects that are not published. A waitlist still in draft will look broken on your staging site, so publish before you test the embed.
Add the waitlist to a Next.js App Router site
These steps use the App Router with TypeScript. The Pages Router works the same way with the component placed in any page. Replace your-slug with the slug from your project's Embed tab, and publish the project first, because the form returns a not-found page until it is live.
- 01
Publish the project and copy the slug
Open your project in LaunchSuite, publish the waitlist page, then open the Embed tab. The slug is the last part of the embed URL, and it is all the component needs.
- 02
Create a client component
Save this as components/waitlist-form.tsx. The "use client" line is required because next/script runs in the browser. Adjust the import path if your project uses a different alias.
"use client"; import Script from "next/script"; type WaitlistFormProps = { slug: string; transparent?: boolean; }; export function WaitlistForm({ slug, transparent = false }: WaitlistFormProps) { return ( <> <div data-launchsuite-waitlist={slug} data-transparent={transparent ? "true" : undefined} /> <Script src="https://launchsuite.co/embed.js" strategy="afterInteractive" /> </> ); } - 03
Render it from a Server Component page
Import the component into any page. The page itself does not need "use client", so the rest of the route stays on the server.
import { WaitlistForm } from "@/components/waitlist-form"; export default function HomePage() { return ( <main> <h1>Join the waitlist</h1> <WaitlistForm slug="your-slug" /> </main> ); } - 04
Run it and submit a test signup
Start the dev server with pnpm dev, open the page and confirm the form appears under your heading. Submit a signup with an address you own, then check the confirmation email and the new contact in LaunchSuite.
- 05
Use the iframe where JavaScript is not wanted
For a route with no client JavaScript at all, or a route reached through client-side navigation, render the iframe from a Server Component. Set the height to fit the form, around 220px with the default fields, and check the result on a phone.
export default function WaitlistPage() { return ( <iframe src="https://launchsuite.co/embed/your-slug" title="Join the waitlist" loading="lazy" style={{ width: "100%", height: 220, border: 0 }} /> ); }
Keep the strategy at afterInteractive or lazyOnload. Avoid beforeInteractive, which can run before hydration finishes.
If next.config sets a Content-Security-Policy, allow https://launchsuite.co in script-src for the script and in frame-src for the iframe.
Route changes that never trigger a full page load can leave the script embed empty. Use the iframe on those routes.
The data-transparent attribute uses the page background behind the form. Pick a theme in the builder whose text reads on that background.
Choose the script or the iframe
The script is the better default for a marketing page. After the form loads, embed.js resizes the iframe to fit the content, so you don't hard-code a height. It also passes the page URL to LaunchSuite, so visits and signups show the page they came from in analytics. The data-transparent option is available too, for dark sections where the host background should show through.
The iframe is the better choice when you want no client JavaScript from the form, or when a route is reached mostly by client-side navigation. You set the height yourself, and the form has to fit that height with the default fields. Because the iframe does not send the page URL, LaunchSuite records the visit from the browser's Referer header instead. A site that sends a strict Referrer-Policy can therefore show these visits without a source page.
- Script: resizes to fit, records the page URL, supports data-transparent, needs a client component
- Iframe: no JavaScript from your site, fixed height, works from a Server Component
Pick the script strategy
next/script accepts four strategies. Use afterInteractive, the default, for a form that sits near the top of the page. It loads once the page has hydrated, so the div is already in the DOM when the script scans for it. Use lazyOnload for a form below the fold, where the script can wait until the browser is idle. The form may appear a moment later, which is fine for a signup block.
Skip beforeInteractive for this embed. It is meant for scripts that must run before the page can work at all, and a signup form is not one of them.
Handle client-side navigation
Next.js loads each script source once per page session. If your visitor lands on the home page, moves to a pricing page and then clicks a Link back to a page that has the form, the script has already run. embed.js doesn't scan again, so the div stays empty. A full page load, a plain anchor tag or the iframe all avoid this.
Test the path your visitors really take. Start on another route, click into the page with the form, and check that the frame appears. If it doesn't, render the iframe on that route instead of the script component.
Publish and confirm the signup path
Publish the project before you test. Copy the slug from the Embed tab, then open the site in a private window so you see what a new visitor sees. Submit a signup with an address you own. The confirmation email should arrive, and the contact should appear in Contacts with the page it came from.
The Free plan shows a Built with LaunchSuite line under the form. Removing that line is part of Pro, along with the custom domain option for the hosted page.
Example: a Next.js marketing site for a dog-walking scheduler
Say you're building a scheduler for dog walkers in Next.js with the App Router. The app lives behind login at /app, and the marketing page at / needs a waitlist. Nobody has signed up yet, and you want the form on the home page without touching the app code.
- 01
Publish the waitlist and copy the slug
Build the page from a template, publish it, and open the Embed tab. The slug is walk-schedule. Nothing else in the Next.js project depends on LaunchSuite until this point.
- 02
Create the client wrapper
Add a WaitlistForm component with "use client" at the top, the div and the next/script tag with afterInteractive. It lives in components, so the marketing page and any future landing pages can reuse it.
- 03
Render it from the home page
The home page stays a Server Component. It renders the heading and the WaitlistForm with slug walk-schedule. The app routes under /app don't import the component at all.
- 04
Check the route you use in practice
Start on /pricing, click the logo to return to /, and confirm the form appears. If it's empty after that navigation, switch the home page to the iframe, because the script would not scan again in that tab.
- 05
Test the signup and confirmation
Submit an address you control. The confirmation email arrives, the contact appears in Contacts, and the visit shows in analytics with the home page as its source.
The home page collects emails for the scheduler, each signup lands in Contacts with a confirmation email, and the app code stays unchanged. When the scheduler is ready, the same list can get a launch-day email through a flow with the manual trigger (Pro).
Start from a template
The SaaS waitlist template has a headline, a short benefit block and an email field above the fold, which suits a developer's marketing page. Change the copy and the theme colours to match your Next.js site before you publish.
Open the template or compare Free and Pro
Free covers one project for good. Pro starts at $4.92 a month, billed yearly.
Questions people ask
Can I put the script in the root layout instead?
You can, and it then loads once for the whole site. The catch is that embed.js only scans the page when it runs. If the form lives on a route that visitors reach later by client-side navigation, the div may stay empty. Keep the script next to the form, or render the iframe on those routes.
Does the form slow down my Next.js site?
The script loads after the page is interactive, and the form renders inside its own iframe, so it doesn't add code to your bundle. If the form sits below the fold, lazyOnload delays the script further. Measure with your own tools before and after, since the effect depends on your page.
Can I style the form to match my site?
The form uses the theme you choose in the builder, not CSS from your site. Fonts, colours and button style come from that theme. The data-transparent option lets your own background show through. Edits to a published page go live immediately.
Does this work with Vercel and my own domain?
Yes. The embed loads from launchsuite.co, so it works on any host, including Vercel previews. Your own domain applies to the hosted LaunchSuite page, and that is a Pro feature with a CNAME record to cname.vercel-dns.com.
Where do the signups go?
Each signup is stored in Contacts and gets the confirmation email. Visits and conversions show in analytics, and sessions record the page URL when you use the script. To send the list a follow-up, add it to an email flow, which is a Pro feature.