Django-google-optimize is a reusable Django application for retrieving the current experiment variant.
Project description
Django-google-optimize
Django-google-optimize is a reusable Django application designed to make running server side Google Optimize A/B test easy.
Installation
Install django-google-optimize with pip:
pip install django-google-optimize
Add the application to installed django applications:
DJANGO_APPS = [
...
"google_optimize",
...
]
Add the context processor:
"context_processors": [
...
"google_optimize.context_processors.google_experiment",
...
]
Getting started
Add settings for the experiments:
- id: Experiment ID required to identify variants for the experiment in templates
- alias: Alias for the experiment ID, optional useful for clarity in templates when accessing experiment variants by key
- variant_aliases: Aliases for each variant, each index represents a Optmize Experiment variant
# google-optimize
GOOGLE_OPTIMIZE_EXPERIMENTS = [
{
"id": "utSuKi3PRbmxeG08en8VNw",
"alias": "redesign",
"variant_aliases": {0: "old_design", 1: "new_design"},
}
]
Now you can access the experiment in templates:
{% if google_optimize.redesign == "new_design" %}
{% include "jobs/jobposting_list_new.html" %}
{% else %}
{% include "jobs/jobposting_list_old.html" %}
{% endif %}
Or use it inline:
<nav class="navbar navbar-expand-lg navbar-dark
{% if google_optimize.redesign == "new_design" %} navbar-redesign{% endif %}">
Full documentation can be found here.
Documentation and Support
More documentation can be found in the docs directory or read online. Open a Github issue for support.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-google-optimize-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98c0d0ea594b7543d1386aeaf386c6eb650677c2b8354ffdf4dfe3ce2a63facb |
|
MD5 | d2089d88ff1caef60224817b7253f70c |
|
BLAKE2b-256 | 85ce2e60d4ac74c7e2682d0a3109f129add14ef190e1bb26ba6bb612270227e1 |
Close
Hashes for django_google_optimize-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcaadd852a66755e0e9eef25dfe10e0004f6e2a34c815dd0e5b2f49df33ae042 |
|
MD5 | 70e00a20188b0b3379cb93c4a3040ea3 |
|
BLAKE2b-256 | 4ab29f6d9d0915ad11e2b9f012780f3e03f626f91ec1f54750cc9b29c74b1808 |