Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adinhodovic/django-google-optimize
Django-google-optimize is a Django application designed to make running server side Google Optimize A/B tests easy.
https://github.com/adinhodovic/django-google-optimize
a-b-test a-b-testing django django-admin experiment-variants google-optimize
Last synced: 3 months ago
JSON representation
Django-google-optimize is a Django application designed to make running server side Google Optimize A/B tests easy.
- Host: GitHub
- URL: https://github.com/adinhodovic/django-google-optimize
- Owner: adinhodovic
- License: mit
- Archived: true
- Created: 2019-12-02T01:14:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T00:47:34.000Z (almost 2 years ago)
- Last Synced: 2024-08-10T08:14:47.185Z (6 months ago)
- Topics: a-b-test, a-b-testing, django, django-admin, experiment-variants, google-optimize
- Language: Python
- Homepage: https://hodovi.cc/blog/django-b-testing-google-optimize/
- Size: 197 KB
- Stars: 40
- Watchers: 4
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- -awesome-django - django-google-optimize - Django application designed to make running server side Google Optimize A/B tests easy. (Third-Party Packages / Testing)
- awesome-django - django-google-optimize - Django application designed to make running server side Google Optimize A/B tests easy. (Third-Party Packages / Testing)
README
# Django-google-optimize
![Lint](https://github.com/adinhodovic/django-google-optimize/workflows/Test/badge.svg)
![Test](https://github.com/adinhodovic/django-google-optimize/workflows/Lint/badge.svg)
[![Coverage](https://codecov.io/gh/adinhodovic/django-google-optimize/branch/master/graphs/badge.svg)](https://codecov.io/gh/adinhodovic/django-google-optimize/branch/master)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/django-google-optimize.svg)](https://pypi.org/project/django-google-optimize/)
[![PyPI Version](https://img.shields.io/pypi/v/django-google-optimize.svg?style=flat)](https://pypi.org/project/django-google-optimize/)Django-google-optimize is a Django application designed to make running Google Optimize A/B tests easy.
[Here is a tutorial on the Google Optimize basics and how to use this Django application.](https://hodovi.cc/blog/django-b-testing-google-optimize/)
## Installation
Install django-google-optimize with pip:
`pip install django-google-optimize`
Add the application to installed Django applications:
```py
# settings.py
INSTALLED_APPS = [
...
"django_google_optimize",
...
]
```Add the middleware:
```py
MIDDLEWARE = [
...
"django_google_optimize.middleware.google_optimize",
...
]
```## Getting started
Head over to the Django admin and add a new Google Optimize experiment. Add an experiment variant with the index 1 and the alias "new_design". Set the experiment cookie's active variant index to 1. Now the active variant index for that experiment is 1 which is the experiment variant with the alias "new_design" that you created.
Now you can access the experiment in templates by the experiment alias and the variant alias:
```django
{% if request.google_optimize.redesign == "new_design" %}
{% include "jobs/jobposting_list_new.html" %}
{% else %}
{% include "jobs/jobposting_list_old.html" %}
{% endif %}
```Or use it inline:
```django
```
Note: The experiment cookie only works in DEBUG mode and is used to avoid interacting with the session to add the `_gaexp` cookie making it possible to test the experiment variants through the Django admin.
Full documentation [can be found here.](https://django-google-optimize.readthedocs.io/en/latest/)
## Documentation and Support
More documentation can be found in the docs directory or read [online](https://django-google-optimize.readthedocs.io/en/latest/). Open a Github issue for support.