Skip to main content

ABToast is an A/B Testing app that is developed in django.

Project description

# ABToast

ABToast is a simple A/B Testing app that is developed in django. This app implements the Django Session functionality to achieve the goal.

### Installation

ABToast requires [Django](https://www.djangoproject.com/download/) to run.

Install ABToast from pip
```sh
$ pip install django-abtoast
```
OR, Get ABToast locally
```sh
$ git clone https://github.com/htadg/ABToast.git ABToast
```

Add ABToast to INSTALLED_APPS
```python
INSTALLED_APPS = (
# Django Default Apps
'django.contrib.admin',
'...',
# ABToast
'ABToast',
)
```
Add ABToast.middleware.ABMiddleware to the project middlewares
```python
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'...',
# Custom Middleware
'ABToast.middleware.ABMiddleware',
)
```
Migrate the database and create admin account
```sh
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py createsuperuser
```
Now Create your own new Tests in the Database
```
Note: You can also create New Experiment and Tests from the Django Admin Panel
```
```python
from datetime import datetime
from dateutil.relativedelta import relativedelta

from ABToast.models import Experiment, Test


# Starting the Experiment from today
start_date = datetime.now()
# End Date for the Experiment
# Experiment runs for two months
end_date = start_date + relativedelta(months=+2)

# Initial Traffic Redirect for the first variant
initial_traffic = 50 # 50%

# Create an Experiment
exp = Experiment.objects.create(name="Homepage Test", template_name="registrations/signup.html", goal="registrations/success", start=start_date, end=end_date, is_active=True)

# Create two variations of the homepage.
# Currently User can only create two Test instances for a particular Experiment
# which means currently user can run A/B Testing on only two variants of a Page
# One Test for the original template
Test.objects.create(template_name="registrations/signup.html", experiment=exp)

# Other Test for the New Variant
Test.objects.create(template_name="registrations/new_signup.html", experiment=exp)
```
Now You can run A/B Test on a view
```python
def home(request, template_name="registrations/signup.html"):
try:
template_name = request.ab.run(template_name)
except TemplateDoesNotExist:
pass
return render_to_response(template_name)
```
### Development

Want to contribute? Great!

Do the necessary changes that you feel and send a pull request.


### Todos

- [ ] Multivariate Testing
- [ ] Add Graphical Information
- [ ] Add Bayesian Formula for the Conversion Rates

License
----

MIT

**Free Software, Hell Yeah!**

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-abtoast-1.2.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

django_abtoast-1.2.0-py2-none-any.whl (8.9 kB view details)

Uploaded Python 2

File details

Details for the file django-abtoast-1.2.0.tar.gz.

File metadata

File hashes

Hashes for django-abtoast-1.2.0.tar.gz
Algorithm Hash digest
SHA256 f9abab60660b197fb318ad968ec2a839c3dcb6e3b9aa9eb512e2b0911d48dbaa
MD5 77d33fc121ba8c65c1ee916ec0ec3ddd
BLAKE2b-256 b9abb494700da415b9e2076b6c91b70cc4ed2b368dd929fe1967fd9e1784739d

See more details on using hashes here.

File details

Details for the file django_abtoast-1.2.0-py2-none-any.whl.

File metadata

File hashes

Hashes for django_abtoast-1.2.0-py2-none-any.whl
Algorithm Hash digest
SHA256 ee1988847b07679f04acbf9be990776432cb6ce6f6101ec04853c919f544f1d0
MD5 41496fde8782ecaecbd05f153df2b78e
BLAKE2b-256 b2d940c734901ccfa028d55ed9314fde4fd6be3db19675d463db8a8d09f7121f

See more details on using hashes here.

Supported by

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