{"id":13626069,"url":"https://github.com/maccman/abba","last_synced_at":"2025-05-16T12:09:58.743Z","repository":{"id":6568149,"uuid":"7810077","full_name":"maccman/abba","owner":"maccman","description":"A/B testing framework","archived":false,"fork":false,"pushed_at":"2020-08-12T06:03:39.000Z","size":470,"stargazers_count":1351,"open_issues_count":11,"forks_count":71,"subscribers_count":47,"default_branch":"master","last_synced_at":"2025-05-15T14:54:41.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/maccman.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}},"created_at":"2013-01-25T00:05:54.000Z","updated_at":"2025-05-10T20:02:03.000Z","dependencies_parsed_at":"2022-08-06T19:15:43.367Z","dependency_job_id":null,"html_url":"https://github.com/maccman/abba","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maccman%2Fabba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maccman%2Fabba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maccman%2Fabba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maccman%2Fabba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maccman","download_url":"https://codeload.github.com/maccman/abba/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527100,"owners_count":22085919,"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":[],"created_at":"2024-08-01T21:02:09.162Z","updated_at":"2025-05-16T12:09:58.726Z","avatar_url":"https://github.com/maccman.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Abba\n\nAbba is a simple a/b testing self-hosted framework built to help improve conversion rates on your site.\n\n* Simple JavaScript API\n* Multi variant support\n* Filter results by date and browser\n\n![Screenshot](http://stripe.github.com/abba/screenshot.png)\n\n## Setup\n\nRequirements:\n\n* Ruby 1.9.3\n* Mongo\n\nThe default username and password are `guard` / `llama`. Change these in `config.yml` or set the environment variables `ABBA_USERNAME` and `ABBA_PASSWORD`, unless you want everybody to access your test results.\nThe environment variables have precedence over the config file. SSL is required in an production environment by default.\n\nTo run locally:\n\n    bundle install\n    thin start\n\n## Heroku 10 seconds setup\n\n    git clone git://github.com/maccman/abba.git \u0026\u0026 cd abba\n    heroku create\n    heroku addons:add mongolab:sandbox\n    git push heroku master\n    heroku open\n\nThe default username and password are `guard` / `llama`.\n\n## A/B testing API\n\nFirst include abba.js using a script tag. The host of this url will need to point to wherever you deployed the app.\n\n    \u003cscript src=\"//localhost:4050/v1/abba.js\"\u003e\u003c/script\u003e\n\nThen call `Abba()`, passing in a test name and set up the control test and variants.\n\n    \u003cscript\u003e\n      Abba('test name')\n        .control('test a', function(){ /* ... */ })\n        .variant('test b', function(){ /* ... */ })\n        .start();\n    \u003c/script\u003e\n\nThe *control* is whatever you're testing against, and is usually the original page. You should only have one control (and the callback can be omitted).\n\nThe *variants* are the variations on the control that you hope will improve conversion. You can specify multiple variants. They require a variant name, and a callback function.\n\nWhen you call `start()` Abba will randomly execute the control or variants' callbacks, and record the results server side.\n\nOnce the user has successfully completed the experiment, say paid and navigated to a receipt page, you need to complete the test. You can do this by invoking `complete()`.\n\n    \u003cscript\u003e\n      // On successful conversion\n      Abba('test name').complete();\n    \u003c/script\u003e\n\n## TLDR example\n\n    \u003cscript src=\"//my-abba.herokuapp.com/v1/abba.js\"\u003e\u003c/script\u003e\n\n    \u003cscript\u003e\n      Abba('Checkout')\n        .control()\n        .variant('Text: Complete Purchase', function(){\n          $('form button').text('Complete Purchase');\n        })\n        .variant('Color: green', function(){\n          $('form button').css({background: 'green'});\n        })\n        .start();\n    \u003c/script\u003e\n\nYou can find a more complete example under `./public/test`.\n\n## Options\n\n### Persisting results\n\nIf set the `persist` option to `true`, then the experiment won't be reset once it has completed. In other words, that visitor will always see that particular variant, and no more results will be recorded for that visitor.\n\n    \u003cscript\u003e\n      Abba('Pricing', {persist: true}).complete();\n    \u003c/script\u003e\n\n### Weighting\n\nYou can set a variant weight, so some variants are used more than others:\n\n    Abba('My Checkout')\n      .control('Control', {weight: 20})\n      .variant('Variant 1', {weight: 3}, function(){\n        $('#test').text('Variant 1 was chosen!');\n      })\n      .variant('Variant 2', {weight: 3}, function(){\n        $('#test').text('Variant 2 was chosen!');\n      })\n      .start();\n\nIn the case above, the Control will be invoked 20 times more often than the other variants.\n\n### Flow control\n\nYou can continue a previously started test using `continue()`.\n\n    Abba('My Checkout')\n      .control()\n      .variant('Variant 1', function(){\n        $('#test').text('Variant 1 was chosen!');\n      })\n      .variant('Variant 2', function(){\n        $('#test').text('Variant 2 was chosen!');\n      })\n      .continue();\n\nNothing will be recorded if you call `continue()` instead of `start()`. If a variant hasn't been chosen previously, nothing will be executed.\n\nYou can reset tests using `reset()`.\n\n    Abba('My Checkout').reset();\n\nLastly, you can calculate the test that you want to run server side, and just tell the JavaScript library which flow was chosen.\n\n    Abba('My Checkout').start('Variant A')\n\n### Links\n\nIf you're triggering the completion of a test on a link click or a form submit, then things get a bit more complicated.\n\nYou need to ensure that tracking request doesn't get lost (which can happen in some browsers if you request an image at the same time as\nnavigating). If the link is navigating to an external page which you don't control, then you have no choice but to cancel the link's default\nevent, wait a few milliseconds, then navigate manually:\n\n    \u003cscript\u003e\n      $('body').on('click', 'a.external', function(e){\n        // Prevent navigation\n        e.preventDefault();\n        var href = $(this).attr('href');\n\n        Abba('My Links').complete();\n\n        setTimeout(function(){\n          window.location = href;\n        }, 400);\n      });\n    \u003c/script\u003e\n\nThat's far from ideal though, and it's much better to place the tracking code on the page you're going to navigate to. If you have control\nover the page, then add the following code that checks the URL's hash.\n\n    \u003cscript\u003e\n      if (window.location.hash.indexOf('_abbaTestComplete') != -1) {\n        Abba('My Links').complete();\n      }\n    \u003c/script\u003e\n\nThen add the hash to the link's URL:\n\n    \u003ca href=\"/blog#_abbaTestComplete\"\u003e\n\n## Credits\n\nThanks to the following projects:\n\n* https://github.com/assaf/vanity\n* https://twitter.github.com/bootstrap\n* http://buildingfirefoxos.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaccman%2Fabba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaccman%2Fabba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaccman%2Fabba/lists"}