Skip to main content

django-lead-capture

Django app for creating AI-powered lead capture and "coming soon" landing pages with email collection, verification, and analytics.

Features

  • 🤖 AI-Powered Copy Generation - Automatically generate compelling landing page copy using LiteLLM (OpenAI, Anthropic, Groq, etc.)
  • 📧 Email Capture & Verification - Collect and verify email addresses with automated welcome emails
  • 📊 Analytics Dashboard - Track page views, conversion rates, and lead sources
  • 📤 CSV Export - Export leads for email marketing platforms
  • ⏱️ Countdown Timers - Optional launch countdown functionality
  • 👥 Social Proof - Display lead counts to increase conversions
  • 🎨 Bootstrap 5 Templates - Clean, responsive landing pages out of the box
  • 🛡️ Spam Protection - Honeypot fields and duplicate detection
  • ⚙️ Django Admin Integration - Manage campaigns and configuration via Django admin

Installation

pip install django-lead-capture

Or with uv:

uv add django-lead-capture

Quick Start

1. Add to INSTALLED_APPS

# settings.py
INSTALLED_APPS = [
    # ...
    'django_lead_capture',
    'solo',  # Required dependency
    'django_bootstrap5',  # Required dependency
]

2. Include URLs

# urls.py
from django.urls import path, include

urlpatterns = [
    # ...
    path("", include("django_lead_capture.urls")),
]

3. Run Migrations

python manage.py migrate

4. Configure LLM API Key

After running the server, you'll see a system check warning:

? django_lead_capture.W001: Lead Capture API key not configured
  HINT: Configure your LLM API key in Django Admin: Lead Capture Configuration

Go to Django Admin → Lead Capture Configuration and enter:

  • API Key: Your LiteLLM-compatible API key (OpenAI, Anthropic, Groq, etc.)
  • Model Name: e.g., gpt-4, claude-3-sonnet-20240229, groq/llama-3.1-8b-instant
  • API Endpoint (optional): Custom endpoint if using a proxy

5. Create a Campaign

  1. Go to Django Admin → Lead Capture → Campaign wizard
  2. Fill out the questionnaire about your product
  3. AI will generate optimized copy
  4. Customize and activate your campaign

Configuration

The package uses Django Solo for configuration. All settings are managed through the Django admin interface.

LiteLLM Model Examples

OpenAI:

  • gpt-4 or gpt-4o-mini

Anthropic:

  • claude-3-opus-20240229
  • claude-3-sonnet-20240229

Groq:

  • groq/llama-3.1-8b-instant
  • groq/compound

Custom/Proxy:

  • Set api_endpoint to your proxy URL
  • Use any LiteLLM-compatible model identifier

See LiteLLM docs for the full list of supported providers.

Usage

Campaign Creation Workflow

  1. Wizard (/lead-capture/wizard/) - Staff-only questionnaire
  2. Edit - Customize AI-generated copy
  3. Preview - Test before going live
  4. Activate - Make campaign public
  5. Analytics - Track performance

Public Campaign URLs

Campaigns are available at: /launch/{slug}/

Example: /launch/my-awesome-product/

Email Verification

Welcome emails include a verification link: /verify/{token}/

CSV Export

Use the Django admin action "Export selected leads to CSV" to export lead data.

Templates

All templates extend base.html. Override them by creating files in your project's templates directory:

your_project/templates/django_lead_capture/
├── wizard.html          # Campaign creation form
├── edit.html            # Edit campaign
├── preview.html         # Preview campaign
├── campaign.html        # Public landing page
├── thank_you.html       # Post-submission page
├── list.html            # Campaign list
├── analytics.html       # Analytics dashboard
├── no_models.html       # API key not configured
└── emails/
    └── welcome.html     # Welcome email template

Models

ComingSoonCampaign

Core model for lead capture campaigns with fields for:

  • Generated content (headline, subheadline, benefits, etc.)
  • SEO metadata
  • Display options (countdown, social proof)
  • Analytics (page views, conversion tracking)

Lead

Email capture model with:

  • Email verification status
  • Traffic source tracking
  • IP address and user agent
  • Timestamps

LeadCaptureConfiguration

Singleton model for LLM configuration:

  • API key
  • Model name
  • Custom API endpoint

Email Configuration

Make sure Django email settings are configured:

# settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your-email@gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'
DEFAULT_FROM_EMAIL = 'noreply@yourdomain.com'

System Checks

The package includes a Django system check that warns if the API key is not configured. This is non-blocking - the app will still work, but the AI wizard will not function until configured.

Development

Running Tests

python manage.py test django_lead_capture

Local Development

The package uses UV for development. Clone the repository and:

uv sync
uv run python manage.py migrate
uv run python manage.py runserver

Requirements

  • Django >= 4.2
  • Python >= 3.10
  • django-solo >= 2.0
  • litellm >= 1.0
  • django-bootstrap5 >= 24.0

License

MIT License - see LICENSE file for details

Contributing

Contributions welcome! Please open an issue or pull request.

Support

Credits

Built by SimpleCTO for the Directory Platform project.

Metadata

Release files for django-lead-capture 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-lead-capture 0.1.0
File Size Uploaded
django_lead_capture-0.1.0.tar.gz 35.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-lead-capture 0.1.0
File Interpreter ABI Platform
django_lead_capture-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 82.1 kB

Release files / django_lead_capture-0.1.0.tar.gz

Download URL django_lead_capture-0.1.0.tar.gz
Size 35.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7410aa6a889267f8934cf012162b085209842d937326ffd5565d5ca106a9be5c
BLAKE2b-256 checksum
How to use checksums
2225687cce9787fcb3220a2bb787e91d94be4dac051addbbb1e68eb89e52ff87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.

Transparency log

Release files / django_lead_capture-0.1.0-py3-none-any.whl

Download URL django_lead_capture-0.1.0-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b670cfc929c8db9ebebf27636be4b3cedd113609a42df702c8809dafdce43b2
BLAKE2b-256 checksum
How to use checksums
8a0f2b8b2c0584d00aec6757314317349df08f649e322b493007457cf8627404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page