Request variant for page
Prerequisites
By this point, you should have completed the previous steps and have the following information at hand for the page you want to request from FHR:
the running A/B tests for the page
the variants of the A/B tests for the user viewing the page
If you're missing the above information please refer to the previous steps in this section.
Requesting the page
In order to request a variant of the given FHR page, all you need to do is supply one extra parameter to the FHR query - fh_abtests. _**_With that parameter you specify which A/B tests and which one of their variants should be applied to the page.
The format of the fh_abtests query parameter should be a semicolon(;) separated string, of A/B test id and variant id combinations separated by a colon(:) - i.e. - it should follow the format:
test-1:variant-for-test-1;test-2:variant-for-test-2;test-3:variant-for-test-3;...
While different users will have different versions of the same page as different A/B test variants are applied, the total number of different combinations possible will be limited so you would benefit from caching this request so whenever a new user is assigned the same variants, you wouldn't need to make a repeated request.
Important! While the order in which the A/B tests are supplied in the request has no effect on the response, you should keep the same order between requests to ensure the query parameters match so that caching works as expected.
Example flow
An example flow for requesting the page would look something like the following:
You request all the running A/B tests. You get a total of three tests:
ab-test-1 with variant-a and variant-b
ab-test-2 with variant-a and variant-b
ab-test-3 with variant-a, variant-b and variant-c
You perform filtering of the running A/B tests for the page you want to request and learn that only ab-test1 and ab-test-3 are active on it.
You perform variant selection for the user of the two tests, and assign variant-a for ab-test-1 and variant-c for ab-test-3.
You put the selections into the fh_abtests parameter in the requested format:
fh_abtests=ab-test-1:variant-a;ab-test-3:variant-c
You make the request and receive the correct version.
You cache the response, and return it whenever a new user is assigned the same variants.
Last updated