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 context processor:
"context_processors": [
...
"django_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
# 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 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
Hashes for django-google-optimize-0.1.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2df263bf02f71e1bf79bc80d95ed8fbdf85c3acc723b91aff582679400f89d66 |
|
MD5 | beb4fab996f613ae4c1c9ee00b090039 |
|
BLAKE2b-256 | fcafe490b222eb8ab8d9043081eba580d34e4d9a751387b885d98231a2e37f09 |
Hashes for django_google_optimize-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f87dbf1c5d4dcd4558da9c80e77d37e2e2ca86f3273ce42a265add19ae752250 |
|
MD5 | de85bb5d8b73e3c790afe441f7b31d5e |
|
BLAKE2b-256 | 5b22d4179333fe725ec50855fe55fe38b26bcbb966987ad24dacf889ac712281 |