Skip to main content

AI-powered lead capture and coming soon pages for Django with LiteLLM integration

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_lead_capture-0.1.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_lead_capture-0.1.0-py3-none-any.whl (47.1 kB view details)

Uploaded Python 3

File details

Details for the file django_lead_capture-0.1.0.tar.gz.

File metadata

  • Download URL: django_lead_capture-0.1.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_lead_capture-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7410aa6a889267f8934cf012162b085209842d937326ffd5565d5ca106a9be5c
MD5 a937e21aabb419fd116eb4b27f28f073
BLAKE2b-256 2225687cce9787fcb3220a2bb787e91d94be4dac051addbbb1e68eb89e52ff87

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lead_capture-0.1.0.tar.gz:

Publisher: publish.yml on heysamtexas/django-lead-capture

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_lead_capture-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_lead_capture-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b670cfc929c8db9ebebf27636be4b3cedd113609a42df702c8809dafdce43b2
MD5 b46677a568986636abba18b90d64170f
BLAKE2b-256 8a0f2b8b2c0584d00aec6757314317349df08f649e322b493007457cf8627404

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_lead_capture-0.1.0-py3-none-any.whl:

Publisher: publish.yml on heysamtexas/django-lead-capture

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page