Skip to main content

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

Lint Test Coverage Supported Python versions PyPI Version

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.

Installation

Install django-google-optimize with pip:

pip install django-google-optimize

Add the application to installed Django applications:

# settings.py
INSTALLED_APPS = [
    ...
    "django_google_optimize",
    ...
]

Add the middleware:

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:

{% 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 %}">

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.

Documentation and Support

More documentation can be found in the docs directory or read online. Open a Github issue for support.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-google-optimize-0.3.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

django_google_optimize-0.3.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file django-google-optimize-0.3.0.tar.gz.

File metadata

  • Download URL: django-google-optimize-0.3.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1036-azure

File hashes

Hashes for django-google-optimize-0.3.0.tar.gz
Algorithm Hash digest
SHA256 beb6a49f36b166a5aea8cf119fab52ee1e651da5a8211041c96dfa0cd64fc82f
MD5 0f879483ea982ead068fcc6db2c685a5
BLAKE2b-256 aad42eae51f641a5b68c19b37af2c2b477dc2c701a9c735699027285841c35d4

See more details on using hashes here.

File details

Details for the file django_google_optimize-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_google_optimize-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b8e19d7e30751ebcc03396a225d2c0887515ab0bc6ad1f73bd1b3ae7371812
MD5 4f299edb4377ed903cd25659a822c31a
BLAKE2b-256 9a893a984893d87f8b2681ed40fe2390ca6c060302cd55aba6a817a2a48505a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page