Django-google-optimize is a reusable Django application designed to make running server side Google Optimize A/B test easy.
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 = [
...
"django_google_optimize",
...
]
Add the middleware:
MIDDLEWARE = [
...
"django_google_optimize.middleware.google_optimize",
...
]
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
# django-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 request.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 request.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
Hashes for django-google-optimize-0.1.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | db1952cbfee70208b98bf3f5274217ab8e3747c62a3a28e07416e22b7e308ac8 |
|
MD5 | 639732ef959d0c6ec1740eded46efadd |
|
BLAKE2b-256 | 29c4f49ed9c160eec399b24a386b1fed6f1c71302f2eeda17d27ed21699e5266 |
Hashes for django_google_optimize-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaa9a678bd21832b264009a5712421854d153c4c3388053e374828353c8f6ce6 |
|
MD5 | 2c07140b65af2b48694345e1d55f802b |
|
BLAKE2b-256 | 9d5e014271f341982cc0f324444860a5bf85119a48718fa8fdd088d0b1a57c77 |