Install the A/B Testing integration
Install A/B Testing from Azion Marketplace and run it on an application to split traffic between two variations with a cookie.
A/B Testing sends each user to one of two variations of an address, an interface, or a workflow, and records the choice in a cookie. Use it to compare how users respond to each variation. It is one of the Marketplace integrations that run on an application.
Four objects must exist before a request reaches a variation: the installed function, an application with the Functions module turned on, a function instance that holds the arguments, and a Rules Engine rule with the Run Function behavior. Each section below creates one of them.
Prerequisites
- An Azion account. To sign in, refer to How to access Azion Console.
- An application served by a workload. To create one, refer to Applications quickstart.
- Two origins, one for each variation the test splits traffic between. Origins were redesigned as Connectors in Azion Console. Each variation reads the ID of its own origin in the
originidargument. - Turning on a product or a module can generate usage costs. For more information, refer to Pricing.
Install the integration
The install adds the A/B Testing function to your account. To install it from Azion Console:
Access Azion Console > Marketplace.
Enter A/B Testing in the Search on Marketplace field, then select the integration’s card. Browsing the cards and the categories reaches the same page.
The card shows Successfully installed! and Latest version installed!. The function is then listed as A/B Testing [Global] in the Function list of the Create Instance drawer.
Turn on the Functions module
An application runs an installed function only when its Functions module is on. The rule that runs A/B Testing uses the Bypass Cache and Forward Cookies behaviors, which require the Application Accelerator module. To turn on both modules:
Access Azion Console > Applications > your application.
In the Main Settings tab, go to the Modules section.
Azion Console confirms that the application was updated.
Create the function instance
A function instance holds the arguments the A/B Testing function reads for one application. To create the instance in your application:
In Applications, select your application, then select the Functions Instances tab.
An application with no instance yet offers the same action as Function Instance. The Create Instance drawer opens.
In Name, enter a unique name that identifies the instance. For example: ab-testing-home.
In Function, select A/B Testing [Global]. The Arguments editor fills with the default arguments of the integration.
In Arguments, replace the default values with the values of your test. Each key is described in the tables below.
The instance appears in the Functions Instances tab with the name you entered.
Arguments
The arguments are one JSON object with a param key. Inside param, the cookie section configures the cookie that records the variation, and the a and b sections configure one variation each. The editor loads these defaults:
The cookie section takes these keys:
| Key | Description |
|---|---|
name | The name of the cookie. Use a unique name that identifies the test |
expiration | The expiration date of the cookie |
max_age | The lifespan of the cookie, in seconds |
domain | The domain where the test runs |
path | The subdomain of the cookie. Use / to set the cookie for all the domains |
The a section configures the first variation, and the b section takes the same keys for the second one:
| Key | Description |
|---|---|
cookie_value | The value that identifies this variation in the cookie |
prob | The probability of sending a user to this variation, from 0 to 1. 0 is a 0% chance and 1 is a 100% chance |
addresses_list | The address of the variation. For example: www.mytest_ab_of_my_site.com:443 |
originid | The ID of the origin of this variation. Azion Console generates it when you register the origin |
live_ingest | Whether the origin is a live stream. Takes true or false |
protocol_policy | The protocol used to reach the origin: force HTTP or HTTPS, or pass preserve to keep the protocol of the request |
path | The subdomain of the cookie for this variation. Leave it empty, "", to make it valid for all domains |
cache_key | A name that identifies the cache of this variation. Use a unique value that no other variation repeats |
host | The host name that the request sends |
Create the rule
The instance runs only when a Rules Engine rule calls it. The rule below matches every request and also adds the Bypass Cache and Forward Cookies behaviors, which require the Application Accelerator module. To create the rule:
In Applications, select your application, then select the Rules Engine tab.
In Name, enter a name for the rule. For example: Run A/B Testing on every request.
In the Phase section, select Request Phase.
In the Criteria section, keep the ${uri} variable and the starts with operator, then enter / as the argument.
In the Behaviors section, select Run Function, then select the instance you created by its name.
Select Add Behavior, then select Bypass Cache.
Select Add Behavior, then select Forward Cookies.
The rule appears in the Rules Engine tab, under the request phase, and runs the A/B Testing instance on every request. The change takes a few minutes to propagate through Azion’s distributed infrastructure, so wait before you test a variation.
For every criterion and behavior a rule accepts, refer to Rules Engine.