README.md in govuk_ab_testing-2.4.3 vs README.md in govuk_ab_testing-3.0.0

- old
+ new

@@ -16,23 +16,22 @@ ## Pre-requisites Before starting this, you'll need to: -- [Read the documentation](https://docs.publishing.service.gov.uk/manual/ab-testing.html) for an overview on how a/b testing works on GOV.UK. +- [Read the documentation](https://docs.publishing.service.gov.uk/manual/ab-testing.html) for an overview on how a/b testing works on GOV.UK. - The cookie and header name in [govuk-cdn-config](https://github.com/alphagov/govuk-cdn-config/blob/master/ab_tests/ab_tests.yaml) must match the test name parameter that you pass to the Gem. The cookie name is case-sensitive. ## Usage -### Outline +### Outline To enable testing in the app, your Rails app needs: 1. [Some piece of logic to be A/B tested](#1-example-ab-test-logic) 2. [A response HTTP header that tells Fastly you're doing an A/B test](#2-http-response-header-to-fastly) -3. [A HTML meta tag that will be used to measure the results, and which specifies - the dimension to use in Google Analytics](#3-add-html-metatag-tags-to-your-layouts) +3. [A HTML meta tag that will be used to measure the results in Google Analytics](#3-add-html-metatag-tags-to-your-layouts) ### 1. Example A/B test logic Let's say you have this controller: @@ -40,11 +39,10 @@ # app/controllers/party_controller.rb class PartyController < ApplicationController def show ab_test = GovukAbTesting::AbTest.new( "your_ab_test_name", - dimension: 300, allowed_variants: ['NoChange', 'LongTitle', 'ShortTitle'], control_variant: 'NoChange' ) @requested_variant = ab_test.requested_variant(request.headers) @requested_variant.configure_response(response) @@ -61,11 +59,11 @@ end ``` In this example, we are running a multivariate test with 3 options being tested: the existing version (control), and two title changes. The minimum -number of variants in any test should be two. +number of variants in any test should be two. ### 2. HTTP response header to Fastly The `configure_response` method used in the example in `step 1` sends the response header. The header helps Fastly to understand which variant was returned to the user and cache appropriately. @@ -146,11 +144,10 @@ As with the `minitest` version, you can also pass in the following options to `with_variant`: - `assert_meta_tag: false` -- `dimension: <number>` #### Minitest The most common usage of an A/B test is to serve two different variants of the same page. In this situation, you can test the controller using `with_variant`. @@ -198,10 +195,10 @@ # test/controllers/party_controller_test.rb class PartyControllerTest < ActionController::TestCase include GovukAbTesting::MinitestHelpers should "show the original" do - setup_ab_variant("your_ab_test_name", "B") # optionally pass in a analytics dimension as the third argument + setup_ab_variant("your_ab_test_name", "B") get :show assert_response_not_modified_for_ab_test("your_ab_test_name") end