{"id":13416075,"url":"https://github.com/adinhodovic/django-google-optimize","last_synced_at":"2025-03-14T23:31:17.764Z","repository":{"id":36467431,"uuid":"225257542","full_name":"adinhodovic/django-google-optimize","owner":"adinhodovic","description":"Django-google-optimize is a Django application designed to make running server side Google Optimize A/B tests easy.","archived":true,"fork":false,"pushed_at":"2023-02-08T00:47:34.000Z","size":202,"stargazers_count":40,"open_issues_count":9,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-10T08:14:47.185Z","etag":null,"topics":["a-b-test","a-b-testing","django","django-admin","experiment-variants","google-optimize"],"latest_commit_sha":null,"homepage":"https://hodovi.cc/blog/django-b-testing-google-optimize/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adinhodovic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-02T01:14:17.000Z","updated_at":"2024-05-29T16:01:37.000Z","dependencies_parsed_at":"2024-01-11T19:17:14.414Z","dependency_job_id":"a1f77d2d-1b16-417e-a0c3-ad6af28470c9","html_url":"https://github.com/adinhodovic/django-google-optimize","commit_stats":{"total_commits":63,"total_committers":3,"mean_commits":21.0,"dds":0.09523809523809523,"last_synced_commit":"d6849b1563a9ba98bca40213f84b911a828df4fd"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adinhodovic%2Fdjango-google-optimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adinhodovic%2Fdjango-google-optimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adinhodovic%2Fdjango-google-optimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adinhodovic%2Fdjango-google-optimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adinhodovic","download_url":"https://codeload.github.com/adinhodovic/django-google-optimize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243663482,"owners_count":20327299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a-b-test","a-b-testing","django","django-admin","experiment-variants","google-optimize"],"created_at":"2024-07-30T21:00:54.079Z","updated_at":"2025-03-14T23:31:16.967Z","avatar_url":"https://github.com/adinhodovic.png","language":"Python","readme":"# Django-google-optimize\n\n![Lint](https://github.com/adinhodovic/django-google-optimize/workflows/Test/badge.svg)\n![Test](https://github.com/adinhodovic/django-google-optimize/workflows/Lint/badge.svg)\n[![Coverage](https://codecov.io/gh/adinhodovic/django-google-optimize/branch/master/graphs/badge.svg)](https://codecov.io/gh/adinhodovic/django-google-optimize/branch/master)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/django-google-optimize.svg)](https://pypi.org/project/django-google-optimize/)\n[![PyPI Version](https://img.shields.io/pypi/v/django-google-optimize.svg?style=flat)](https://pypi.org/project/django-google-optimize/)\n\nDjango-google-optimize is a Django application designed to make running Google Optimize A/B tests easy.\n\n[Here is a tutorial on the Google Optimize basics and how to use this Django application.](https://hodovi.cc/blog/django-b-testing-google-optimize/)\n\n## Installation\n\nInstall django-google-optimize with pip:\n\n`pip install django-google-optimize`\n\nAdd the application to installed Django applications:\n\n```py\n# settings.py\nINSTALLED_APPS = [\n    ...\n    \"django_google_optimize\",\n    ...\n]\n```\n\nAdd the middleware:\n\n```py\nMIDDLEWARE = [\n    ...\n    \"django_google_optimize.middleware.google_optimize\",\n    ...\n]\n```\n\n## Getting started\n\nHead 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.\n\nNow you can access the experiment in templates by the experiment alias and the variant alias:\n\n```django\n{% if request.google_optimize.redesign == \"new_design\" %}\n{% include \"jobs/jobposting_list_new.html\" %}\n{% else %}\n{% include \"jobs/jobposting_list_old.html\" %}\n{% endif %}\n```\n\nOr use it inline:\n\n```django\n\u003cnav class=\"navbar navbar-expand-lg navbar-dark\n{% if request.google_optimize.redesign == \"new_design\" %} navbar-redesign{% endif %}\"\u003e\n```\n\nNote: 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.\n\nFull documentation [can be found here.](https://django-google-optimize.readthedocs.io/en/latest/)\n\n## Documentation and Support\n\nMore documentation can be found in the docs directory or read [online](https://django-google-optimize.readthedocs.io/en/latest/). Open a Github issue for support.\n","funding_links":[],"categories":["Third-Party Packages"],"sub_categories":["Testing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadinhodovic%2Fdjango-google-optimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadinhodovic%2Fdjango-google-optimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadinhodovic%2Fdjango-google-optimize/lists"}