A professional Python-based landing page generator featuring built-in A/B testing capabilities. Create, test, and optimize your landing pages with real-time analytics.
- Visual Editor Interface - Intuitive controls for customizing both A/B test variants
- Real-time A/B Testing - Automatic 50/50 traffic split between variants
- Analytics Dashboard - Track views, clicks, and conversion rates in real-time
- Live Preview - See how your landing pages look before deployment
- Export Ready Code - Download production-ready Python Flask application
- Responsive Design - Mobile-friendly landing pages
- Modern UI - Sleek black design with orange highlights
A/B testing (also known as split testing) is a method of comparing two versions of a webpage to determine which one performs better. Visitors are randomly shown either version A or version B, and their interactions are tracked to identify the most effective design.
Before you begin, ensure you have the following installed:
- Python 3.7 or higher
- pip (Python package installer)
-
Clone the repository
git clone https://github.com/SYOP200/landing-page-generator.git cd landing-page-generator -
Create a virtual environment (recommended)
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install flask
-
Run the application
python landing_page_ab_test.py
-
Open your browser Navigate to
http://localhost:5000 -
View analytics Visit
http://localhost:5000/analyticsto see real-time test results
landing-page-generator/
β
βββ landing_page_ab_test.py # Main Flask application
βββ README.md # This file
βββ requirements.txt # Python dependencies
Open landing_page_ab_test.py and modify the variants dictionary:
variants = {
'A': {
'headline': 'Your Custom Headline',
'subheadline': 'Your custom subheadline',
'cta_text': 'Click Here',
'cta_color': '#ff6b35'
},
'B': {
'headline': 'Alternative Headline',
'subheadline': 'Different subheadline',
'cta_text': 'Get Started',
'cta_color': '#ff8c42'
}
}By default, traffic is split 50/50. To change this, modify the landing_page() function:
# For 70/30 split (70% A, 30% B)
variant = random.choices(['A', 'B'], weights=[70, 30])[0]The analytics endpoint (/analytics) returns JSON data with:
- views - Total number of page views for each variant
- clicks - Number of CTA button clicks
- conversion_rate - Percentage of visitors who clicked (clicks/views Γ 100)
Example response:
{
"A": {
"views": 1247,
"clicks": 156,
"conversion_rate": 12.51
},
"B": {
"views": 1198,
"clicks": 189,
"conversion_rate": 15.78
}
}For production use, consider:
-
Use a production WSGI server
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 landing_page_ab_test:app
-
Add a database - Store analytics in PostgreSQL, MySQL, or SQLite instead of in-memory storage
-
Implement session tracking - Use cookies or sessions to ensure users see consistent variants
-
Add environment variables - Store configuration in
.envfiles -
Enable HTTPS - Use SSL certificates for secure connections
Extend the system to test 3+ variants:
variants = {
'A': {...},
'B': {...},
'C': {...}
}
variant = random.choice(['A', 'B', 'C'])For reliable results, ensure:
- Minimum 100 conversions per variant
- At least 1-2 weeks of testing
- Consistent traffic patterns
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If port 5000 is already in use:
app.run(debug=True, host='0.0.0.0', port=8080)Make sure you're making actual page visits and clicking the CTA button. Refresh the /analytics endpoint to see updates.
Ensure Flask is installed in your active Python environment:
pip list | grep FlaskSYOP200 - @SYOP200
Project Link: https://github.com/SYOP200/landing-page-generator
- Flask framework for the backend
- Modern web design principles
- A/B testing methodologies
Made with β€οΈ and Python