Skip to main content

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.

Metadata

Release files for django-google-optimize 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-google-optimize 0.3.0
File Size Uploaded Provenance Actions
django-google-optimize-0.3.0.tar.gz 5.8 kB Without provenance Details for django-google-optimize-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-google-optimize 0.3.0
File Interpreter ABI Platform Actions
django_google_optimize-0.3.0-py3-none-any.whl Python 3 none any Details for django_google_optimize-0.3.0-py3-none-any.whl

Total release size: 12.9 kB

Release files / django-google-optimize-0.3.0.tar.gz

Download URL django-google-optimize-0.3.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
beb6a49f36b166a5aea8cf119fab52ee1e651da5a8211041c96dfa0cd64fc82f
BLAKE2b-256 checksum
How to use checksums
aad42eae51f641a5b68c19b37af2c2b477dc2c701a9c735699027285841c35d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1036-azure

Release files / django_google_optimize-0.3.0-py3-none-any.whl

Download URL django_google_optimize-0.3.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7b8e19d7e30751ebcc03396a225d2c0887515ab0bc6ad1f73bd1b3ae7371812
BLAKE2b-256 checksum
How to use checksums
9a893a984893d87f8b2681ed40fe2390ca6c060302cd55aba6a817a2a48505a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1036-azure

Security for django-google-optimize 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page