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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae022b701c67ec7c23f62701275146d3e846447600b2b638218ebf483518019c |
|
MD5 | 051b04859db4bf3ab4eaff26d65d782b |
|
BLAKE2b-256 | 0661690d0c6828f97709cc2f9ca87131abfe47d6bffd7b9f88c372e3a70a92e5 |
Close
Hashes for django_google_optimize-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89df35bb40ecb3999abc6bcc9f017d05d3b612e581834294236cf56214cbc0d8 |
|
MD5 | eeeef11072acf81977a8aad0cf4c1739 |
|
BLAKE2b-256 | 2288456d8d837d7df114f367466ed75d518b3800a26ba528c2135987cd8fc0ff |