splitforms.com
LEAD MAGNET DOWNLOAD · GATSBY

Lead Magnet Download for Gatsby

Email-gated download form for ebooks, PDFs, checklists, and templates. Free for 1,000 submissions per month — no backend, no SDK, no plugin.

1,000/mo free·no card·drop-in for Gatsby
Form.tsxtsx55 lines
01'use client';
02
03import { useState, type FormEvent } from 'react';
04
05export default function LeadMagnetForm() {
06 const [status, setStatus] = useState<'idle' | 'sending' | 'sent' | 'error'>('idle');
07
08 async function onSubmit(e: FormEvent<HTMLFormElement>) {
09 e.preventDefault();
10 setStatus('sending');
11
12 const data = new FormData(e.currentTarget);
13 data.set('access_key', 'YOUR_ACCESS_KEY');
14 data.set('subject', 'New lead magnet download');
15
16 const res = await fetch('https://splitforms.com/api/submit', {
17 method: 'POST',
18 body: data,
19 headers: { Accept: 'application/json' },
20 });
21
22 const json = await res.json();
23 setStatus(json.success ? 'sent' : 'error');
24 if (json.success) e.currentTarget.reset();
25 }
26
27 if (status === 'sent') return <p>Thanks — we&rsquo;ll be in touch.</p>;
28
29 return (
30 <form onSubmit={onSubmit}>
31 <label htmlFor="name">First name *</label>
32 <input id="name" type="text" name="name" placeholder="Jane" required />
33 <label htmlFor="email">Work email *</label>
34 <input id="email" type="email" name="email" placeholder="jane@company.com" required />
35 <label htmlFor="company">Company</label>
36 <input id="company" type="text" name="company" placeholder="Acme Inc" />
37 <label htmlFor="role">What's your role?</label>
38 <select id="role" name="role">
39 <option value="">Choose…</option>
40 <option>Founder / CEO</option>
41 <option>Engineer</option>
42 <option>Designer</option>
43 <option>Marketer</option>
44 <option>Product manager</option>
45 <option>Other</option>
46 </select>
47
48 <button type="submit" disabled={status === 'sending'}>
49 {status === 'sending' ? 'Sending…' : 'Send'}
50 </button>
51
52 {status === 'error' && <p>Something went wrong. Try again.</p>}
53 </form>
54 );
55}
1,000
submissions / mo, free
4
fields, ready to ship
5
code outputs
60s
from copy to inbox
§ 00Quick answerReact / Next.js · marketing

Yes — this is the shortest safe path for Gatsby.

Use the React / Next.js snippet on this page, keep the lead magnet download fields visible in your Gatsby UI, and let splitforms handle delivery, spam filtering, storage, and webhooks.

best implementation

Paste the React / Next.js version, then replace YOUR_ACCESS_KEY.

The posted payload contains first name, work email, company, what's your role?. Required fields are first name and work email.

native gatsby reality

Gatsby builds a static React app, so 'native' means choosing between (a) Netlify Forms (Gatsby-on-Netlify only, 100 free submissions/month, gatsby-plugin-netlify required), (b) Gatsby Functions (deprecated in Gatsby 5 — they were removed when Gatsby Cloud shut down), or (c) a third-party form backend.

use case fit

Ungated content gets read; gated content builds your list. The lead-magnet form trades the PDF for an email plus 1-2 qualifying questions, so the nurture sequence segments by intent.

§ 01Lead Magnet Download × Gatsbywhy this combination, in 80 words

Built for Gatsby developers who hate operating a backend.

Splitforms is the form-to-email API for Gatsby sites. One POST endpoint, no SDK, no plugin — drop the lead magnet download into a page and ship.

Splitforms is the form-to-email API for Gatsby sites. One POST endpoint, spam filtering, signed webhooks, file uploads, a real dashboard — drop-in, no server, no PHP. Free for 1,000 submissions per month, $5/mo Pro for 5,000, $59 for 3 years if you hate recurring SaaS bills.

✦ what you get on the free plan
  • 1,000 form submissions per month
  • Unlimited forms — one key, many pages
  • Spam protection (honeypot + classifier)
  • Webhooks: Slack, Discord, WhatsApp, custom
  • CSV export of all submissions
  • Email notifications (CC and BCC on Pro)
§ 02Copy-paste codeReact / Next.js · 55 lines

Drop into any Gatsby project.

Replace YOUR_ACCESS_KEY with your splitforms key, paste into a Gatsby page, and ship. No build-time integration required.

Form.tsxtsx55 lines
01'use client';
02
03import { useState, type FormEvent } from 'react';
04
05export default function LeadMagnetForm() {
06 const [status, setStatus] = useState<'idle' | 'sending' | 'sent' | 'error'>('idle');
07
08 async function onSubmit(e: FormEvent<HTMLFormElement>) {
09 e.preventDefault();
10 setStatus('sending');
11
12 const data = new FormData(e.currentTarget);
13 data.set('access_key', 'YOUR_ACCESS_KEY');
14 data.set('subject', 'New lead magnet download');
15
16 const res = await fetch('https://splitforms.com/api/submit', {
17 method: 'POST',
18 body: data,
19 headers: { Accept: 'application/json' },
20 });
21
22 const json = await res.json();
23 setStatus(json.success ? 'sent' : 'error');
24 if (json.success) e.currentTarget.reset();
25 }
26
27 if (status === 'sent') return <p>Thanks — we&rsquo;ll be in touch.</p>;
28
29 return (
30 <form onSubmit={onSubmit}>
31 <label htmlFor="name">First name *</label>
32 <input id="name" type="text" name="name" placeholder="Jane" required />
33 <label htmlFor="email">Work email *</label>
34 <input id="email" type="email" name="email" placeholder="jane@company.com" required />
35 <label htmlFor="company">Company</label>
36 <input id="company" type="text" name="company" placeholder="Acme Inc" />
37 <label htmlFor="role">What's your role?</label>
38 <select id="role" name="role">
39 <option value="">Choose…</option>
40 <option>Founder / CEO</option>
41 <option>Engineer</option>
42 <option>Designer</option>
43 <option>Marketer</option>
44 <option>Product manager</option>
45 <option>Other</option>
46 </select>
47
48 <button type="submit" disabled={status === 'sending'}>
49 {status === 'sending' ? 'Sending…' : 'Send'}
50 </button>
51
52 {status === 'error' && <p>Something went wrong. Try again.</p>}
53 </form>
54 );
55}
ALTPrefer plain HTML? View the universal lead magnet download HTML snippet26 lines
form.htmlHTML
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <input type="hidden" name="subject" value="New lead magnet download">

  <label for="name">First name *</label>
  <input id="name" type="text" name="name" placeholder="Jane" required>
  <label for="email">Work email *</label>
  <input id="email" type="email" name="email" placeholder="jane@company.com" required>
  <label for="company">Company</label>
  <input id="company" type="text" name="company" placeholder="Acme Inc">
  <label for="role">What's your role?</label>
  <select id="role" name="role">
    <option value="">Choose…</option>
    <option>Founder / CEO</option>
    <option>Engineer</option>
    <option>Designer</option>
    <option>Marketer</option>
    <option>Product manager</option>
    <option>Other</option>
  </select>

  <!-- honeypot — bots fill every field -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>
§ 03Setup3 steps · 60 seconds · zero config

Generate, embed, receive.

Three actions stand between you and your first lead magnet download submission. None of them require a backend, a database, or a CAPTCHA library.

STEP 01GENERATE

Generate a free splitforms key

Sign in at splitforms.com — your access key is created instantly. No credit card, no setup wizard, no SDK to install.

Create your form
key=sk_live_••••••••
STEP 02EMBED

Paste the lead magnet download into your Gatsby project

Drop the form snippet into a Gatsby page, component, or layout. Replace YOUR_ACCESS_KEY with the key from your dashboard. The form action is a hard-coded URL — no env vars or build-time wiring needed.

snippettsx
'use client';
  …
</form>
STEP 03RECEIVE

Receive submissions

Email arrives within seconds. Webhook fires in parallel. Dashboard updates live. CSV export, Slack/Discord forwarding, BCC to your team — all included free.

inbox · 1 newjust now
FROM contact@yoursite.com
New lead magnet download
Maya Iyer maya@studio71.co
Loved the demo — quick question about pricing on the 3-year plan. Are usage limits per project or account-wide?
§ 03bLead Magnet Download Form (Ebook / PDF / Checklist Gate)template-specific playbook

The reason this lead magnet download exists.

Multi-step (Typeform-style) · webhooks into ConvertKit / HubSpot / Mailchimp.

why it matters

Lead magnets — ebooks, checklists, templates, swipe files, mini-courses — are the workhorse of B2B content marketing. Gated downloads convert at 25-50% of landing-page visitors (vs 1-2% for newsletter signups), but only when the magnet is truly valuable. The form captures email plus 1-2 qualifying questions ('what's your role?', 'what's your team size?') so the nurture sequence segments by intent. Multi-step boosts completion vs a single form. After submit, the user is redirected to the PDF or it's emailed via webhook + auto-responder. Push the email to your ESP segmented by lead-magnet topic — that's how content marketers build audience taxonomies that actually convert downstream.

route the submission
01

Step 1: capture email

Single email field — frictionless step 1. Once the email is in, momentum carries through later qualifying questions.

02

Step 2-3: qualify role / team

One or two questions on role and team size. Optional but most users complete because they're invested. Each answer becomes a tag in the ESP for downstream segmentation.

03

Deliver the magnet

Auto-respond with the PDF link (or redirect to a thank-you page that auto-downloads). Webhook to ConvertKit / HubSpot / Mailchimp into a 'lead-magnet:[topic]' audience for the nurture sequence.

§ 03cGatsby production notesnative path · deploy · gotchas

What changes when this lead magnet download lives in Gatsby.

These notes come from the Gatsby platform registry and are rendered on this template page so crawlers see the framework-specific answer without opening a separate guide.

without splitforms

Gatsby builds a static React app, so 'native' means choosing between (a) Netlify Forms (Gatsby-on-Netlify only, 100 free submissions/month, gatsby-plugin-netlify required), (b) Gatsby Functions (deprecated in Gatsby 5 — they were removed when Gatsby Cloud shut down), or (c) a third-party form backend. Gatsby v4 had Functions running as Lambda-equivalent serverless routes; v5 removed them entirely. Result: every Gatsby contact form today uses an external service. Splitforms is a drop-in replacement — same shape as Netlify Forms (POST to a URL), same shape as Formspree, but with 5× the free monthly submissions and built-in spam filtering.

deploy notes

Gatsby builds static HTML + JS that deploys to any host: Netlify, Vercel, Cloudflare Pages, AWS Amplify, S3 + CloudFront, Gatsby Cloud (sunset 2024 — migrate). The form posts cross-origin to splitforms regardless of host. Env vars exposed to the browser bundle must be prefixed GATSBY_ — anything else is undefined client-side. The key gets bundled into the JS at build time; lock it to your domain in the splitforms dashboard. For headless Gatsby + WordPress / Contentful setups, the form lives in the React tree, not the CMS — no special CMS wiring required.

Gatsby gotcha

GATSBY_ prefix required for env vars exposed at build time

Gatsby's webpack config only exposes process.env.* variables prefixed with GATSBY_. If you write process.env.SPLITFORMS_KEY, you'll get undefined in the browser bundle. Rename to GATSBY_SPLITFORMS_KEY — and accept that it's bundled into the static JS (lock the key to your domain in the splitforms dashboard).

Gatsby gotcha

Gatsby's <Link> can't wrap a form's submit handler

Gatsby's <Link> component prevents default navigation. If you wrap your form in <Link to="/thanks"> thinking the redirect will fire, it won't — the form's submit event runs, but the navigation is suppressed. Use a hidden redirect input on the form and let splitforms handle the 302.

Gatsby gotcha

SSR + client hydration mismatch on form initial state

If you use useState('idle') in your form and render any state-dependent UI on first paint, Gatsby's static HTML and React's client render can diverge — you'll see a hydration warning. Render the form unconditionally; only render status messages inside the handler-triggered branches.

Gatsby gotcha

Gatsby v5 partial hydration changed how forms hydrate

Gatsby 5 introduced partial hydration via React Server Components. If your form is in a Server Component, the onSubmit handler won't bind. Add 'use client' at the top of the file (or use a separate ContactForm.client.jsx).

PATTERN A

Pattern A — React component (Gatsby v4/v5)

Standard React function component, useState for status. Drop into src/components/ContactForm.jsx and import on any page. Set GATSBY_SPLITFORMS_KEY in .env.production and .env.development. Use the same wiring for the lead magnet download fields on this page.

pattern-a.jsxjsx16 lines
01import React, { useState } from "react";
02export default function ContactForm() {
03 const [status, setStatus] = useState("idle");
04 return (
05 <form onSubmit={async (e) => {
06 e.preventDefault(); setStatus("loading");
07 const fd = new FormData(e.target);
08 fd.append("access_key", process.env.GATSBY_SPLITFORMS_KEY);
09 const r = await fetch("https://splitforms.com/api/submit", { method: "POST", body: fd });
10 setStatus((await r.json()).success ? "ok" : "err");
11 }}>
12 <input name="email" type="email" required />
13 <button disabled={status === "loading"}>Send</button>
14 </form>
15 );
16}
PATTERN B

Pattern B — partial hydration (Gatsby v5)

Gatsby 5's partial hydration mounts only the components marked client-bound. Add 'use client' at the top of the form file so the onSubmit handler binds at hydration time; the rest of the page stays static. Use the same wiring for the lead magnet download fields on this page.

pattern-b.jsxjsx7 lines
01// src/components/ContactForm.jsx
02"use client";
03import React, { useState } from "react";
04export default function ContactForm() {
05 const [status, setStatus] = useState("idle");
06 // ...same body as Pattern A
07}
§ 04Field-by-field rundown4 fields · names you POST

What every field actually does.

Each field below ships in the lead magnet download template — rename, remove, or add your own. Splitforms accepts any name you POST.

nameREQUIRED
TEXT

First name

Greeting + dashboard label so submissions don't all read 'anonymous'.

placeholder · Jane
emailREQUIRED
EMAIL

Work email

Reply-to address — splitforms wires this so hitting reply goes back to the sender.

placeholder · jane@company.com
company
TEXT

Company

Lets you sort enterprise vs SMB inquiries before you reply.

placeholder · Acme Inc
role
SELECT

What's your role?

Buyer-persona signal — IC vs decision-maker changes the follow-up cadence.

Founder / CEOEngineerDesignerMarketerProduct managerOther
§ 05Lead Magnet Download on other frameworks21 frameworks · same backend

One backend. Every framework.

The same lead magnet download template works on every framework splitforms supports. Pick yours.

§ 06Questions9 answered

Lead Magnet Download on GatsbyFAQ.

Direct answers, no marketing fluff. Missing one? Email hello@splitforms.com.

01Does this lead magnet download work on Gatsby?
Yes. The form is plain HTML with a single POST endpoint, so it runs on any Gatsby site without server-side code, plugins, or SDKs. Drop the snippet into a Gatsby page or component and submissions land in your inbox via splitforms.com.
02How much does the lead magnet download cost on Gatsby?
Free for 1,000 submissions per month — no credit card, no trial. Pro is $5/mo for 5,000 submissions, and there's a one-time $59 3-year plan (15,000 submissions/mo for 36 months). The same pricing applies regardless of which framework hosts the form.
03Can I customize the fields?
Yes. The template ships with sensible defaults (first name, work email, company, what's your role?…) — add, remove, or rename any of them. Splitforms accepts whatever fields you POST.
04How does spam protection work on the lead magnet download?
A hidden honeypot field catches dumb bots, and a tuned classifier scores the rest. You only see real submissions in your dashboard. No CAPTCHA, no friction for human users — and it works the same on Gatsby as on any other framework.
05Can I send the lead magnet download submissions to Slack or Discord?
Yes. Webhooks are free on every plan, with auto-formatted payloads for Slack, Discord, and WhatsApp (via CallMeBot). Or send raw signed JSON to any URL — Zapier, n8n, your own server. Configure in the splitforms dashboard.
06Will it work on a static Gatsby site?
Yes — the form posts directly to splitforms from the browser, so no server is involved. Works on Vercel, Netlify, GitHub Pages, Cloudflare Pages, S3, or any plain Apache host.
07Should I redirect to the PDF or email it?
Email it. Redirects to a Drive / S3 link mean the user gets the PDF without confirming the email — and the email might be a typo or a temporary address. Email delivery confirms the address by requiring an open. Add a 'didn't get it?' resend button on the thank-you page for the rare typo case.
08Can I integrate with ConvertKit / HubSpot / Mailchimp?
Yes — webhook the JSON into the ESP. ConvertKit's 'tags' map naturally to lead-magnet topics; HubSpot's 'lists' do the same. The nurture sequence triggers on tag-add and the topic-specific drip starts immediately. Most B2B teams use this exact pattern.
09Is gating content GDPR-safe?
If you have EU visitors, the consent for marketing email needs to be explicit and unbundled — meaning a separate checkbox 'I want to receive emails about [topic]' that's not pre-checked and not bundled with 'I accept the download'. Bundled consent has been challenged in EU rulings; unbundled is the safe play.
§ 07Comparisonvs Web3Forms · vs Formspree

splitforms vs everything else.

Same drop-in API. More free submissions, real webhooks on the free tier, MCP support no other backend has.

FeatureWeb3FormsFormspreesplitforms
Free monthly submissions250501,000
Custom fields beyond contactYesPro tierFree
Webhooks (Slack / Discord)Pro tierPro tierFree, signed
AI / MCP submission inboxNoNoYes
Long-term plan (3-year flat)$59 every 3 years
✻ ✻ ✻

Ship a lead magnet download on Gatsby in 60 seconds.

1,000 submissions per month, free forever. No credit card. Copy the snippet above and paste it into your Gatsby project.

Get free access key →Read the docs
founders pricing locked in · early access open