Are you using A/B testing to compare two versions of a webpage or app against each other to determine which one performs better? You can include Adaptive Acceleration-related data in your A/B testing model.

📘

This works in tandem with the process outlined in Improve page load performance to fully set up and activate your Ion property.

This content primarily replaces that topic's section, 4 - Edit your rule tree (optional). Use what's here to PATCH your property's rule tree to include A/B testing support.

Method 1: Enabled manually

This example applies A/B testing by redirecting a request to one of two origin servers, based on the contents of a cookie file included with the request. The cookie will use the same file name, but its content will vary, based on the desired site experience. So, when the cookie file is read, origin "A" or origin "B" is contacted to deliver the appropriate site experience.

Before you begin

This process assumes you already have an A/B testing model in place using a cookie in the request. You'll need to know the name of this cookie file.

Edit your Ion rule tree

Here, we'll PATCH your rule tree to ensure all applicable behaviors are set.

Patch a rule tree
Open Recipe

👍

We offer plugins to help with a rule tree

Rule trees are maintained in a special form of JSON. We offer two tools you can use to help navigate and edit your rule tree before you include it in the PATCH operation. Check out the VS code or Eclipse IDE plugins.

This behavior just needs to remain in the rule tree. Notice its "enable": "true" member. Set this way, the default value of enabled is used.

Include the http3behavior

{
    "name": "http3",
    "options": {
        "enable": true
    }
},

📘

HTTP/2 is still supported

This older protocol is still supported and automatically included in your rule tree. Leave it in to ensure full support.

Include the mPulse RUM behavior

This behavior is also included by default. Its base settings are all you need. They enable it for use as the real-user monitoring (RUM) source beacon that Adaptive Acceleration uses to gather its data and it supports all Adaptive Acceleration features.

{
    "name": "mPulse RUM",
    "children": [],
    "behaviors": [
        {
            "name": "mPulse",
            "options": {
                "apiKey": "",
                "bufferSize": "",
                "configOverride": "",
                "enabled": true,
                "loaderVersion": "V12",
                "requirePci": false,
                "titleOptional": ""
            }
        }
    ],
    "criteria": [],
    "criteriaMustSatisfy": "all",
    "comments": "Collect..."
},

Include the adaptiveAcceleration behavior

This is added by default to a new Ion property. Make sure these parameters are set in it to enable A/B testing:

  • enablePush. Set this to true to enable the automatic push feature.
  • enablePreconnect. Set this to true to enable the automatic preconnect feature.
  • preloadEnable. Set this to true to enable the automatic font preload feature.
  • source. Set this to mPulse to use it as the real-user monitoring beacon source for Adaptive Acceleration.
  • abLogic. Set this to MANUAL.
  • cookieName. Set this to the name of the cookie file that you've configured for use in your A/B testing model.

You can leave all other settings at their default.

{
    "name": "Adaptive acceleration",
    "children": [],
    "behaviors": [
        {
            "name": "adaptiveAcceleration",
            "options": {
                "enablePreconnect": true,
                "enablePush": true,
                "enableRo": false,
                "preloadEnable": true,
                "source": "mPulse",
                "titleHttp2ServerPush": "",
                "titlePreconnect": "",
                "titlePreload": "",
                "titleRo": "",
                "compression": "",
                "abLogic": "MANUAL",
                "cookieName": "abtest-docsassociates"
            }
        }
    ],
    "criteria": [],
    "criteriaMustSatisfy": "all",
    "comments": "Automatically..."
}

Method 2: Use Cloudlets

You can also set up an A/B testing scenario using Cloudlets. Cloudlets bring a site's business logic closer to the end user by placing it on the edge of the content delivery platform. ​

Add a Cloudlet policy

A policy is a container for the rules that govern how a Cloudlet behaves. You can use the Cloudlets API to:

  1. List groups in Cloudlets API to retrieve information about which Cloudlets are associated with the groups you have edit privileges for. You'll need the groupId values returned by this request when you create a Cloudlet policy.

  2. Create an Audience Segmentation (AS) policy using the groupId you retrieved from the previous step and the code AS. Store the policy id that's returned in the response.

  3. Create a policy version to include a version description and match rules.

  4. Activate a policy version on the staging or production network. Store the activation id from the response.

  5. Get the status of the activation. Once the status reads as SUCCESS the policy is ready to go.

Edit your Ion rule tree

This shows how to PATCH your rule tree to ensure all applicable behaviors are set.

Patch a rule tree
Open Recipe

👍

We offer plugins to help with a rule tree

Rule trees are maintained in a special form of JSON. We offer two tools you can use to help navigate and edit your rule tree before you include it in the PATCH operation. Check out the VS code or Eclipse IDE plugins.

Include the http3 behavior

This behavior is included by default in your Ion property. Ensure it's formatted as follows to enable it:

{
    "name": "http2",
    "options": {
        "enabled": ""
    }
},

📘

HTTP/2 is still supported

This older protocol is still supported and automatically included in your rule tree. Leave it in to ensure full support.

Include the mPulse RUM behavior

This behavior is also included by default. Its base settings are all you need. They enable it for use as the real-user monitoring (RUM) source beacon that Adaptive Acceleration uses to gather its data and it supports all Adaptive Acceleration features.

{
    "name": "mPulse RUM",
    "children": [],
    "behaviors": [
        {
            "name": "mPulse",
            "options": {
                "apiKey": "",
                "bufferSize": "",
                "configOverride": "",
                "enabled": true,
                "loaderVersion": "V12",
                "requirePci": false,
                "titleOptional": ""
            }
        }
    ],
    "criteria": [],
    "criteriaMustSatisfy": "all",
    "comments": "Collect..."
},

Include the adaptiveAcceleration behavior

This is added by default to a new Ion property. Make sure these parameters are set in it to enable A/B testing:

  • enablePush. Set this to true to enable the automatic push feature.
  • enablePreconnect. Set this to true to enable the automatic preconnect feature.
  • preloadEnable. Set this to true to enable the automatic font preload feature.
  • source. Set this to mPulse to use it as the real-user monitoring beacon source for Adaptive Acceleration.
  • abLogic. Set this to CLOUDLETS.

You can leave all other settings at their default.

{
    "name": "Adaptive acceleration",
    "children": [],
    "behaviors": [
        {
            "name": "adaptiveAcceleration",
            "options": {
                "enablePreconnect": true,
                "enablePush": true,
                "enableRo": false,
                "preloadEnable": true,
                "source": "mPulse",
                "titleHttp2ServerPush": "",
                "titlePreconnect": "",
                "titlePreload": "",
                "titleRo": "",
                "compression": "",
                "abLogic": "CLOUDLETS"
            }
        }
    ],
    "criteria": [],
    "criteriaMustSatisfy": "all",
    "comments": "Automatically..."
}

Add the cloudlet

You also need to edit your rule tree to include the cloudlet that will add A/B testing to your Ion property.

For this example, we'll add a new rule that applies to requests that contain a specific query string and add the Cloudlet as a behavior. This way, the rule is the last in the list and it'll be acted on first when the property is read. Add the rule below all of the rules in the default rule's children array. Specifically, set the following:

  • name. Enter a name for the rule, such as AB testing for A2.
  • behaviors. Configure this to call out the appropriate Cloudlet:
    • name. Set this to audienceSegmentation for the AS Cloudlet policy you created.
    • options. Set enabled to true and cloudletPolicy to the policy id you stored after creating your Cloudlet policy. Configure all of the other options for this behavior to fit your needs for A/B testing.
  • criteria. Set the match criterion for the rule, using the following values:
    • name. Set this to queryStringParameter to use the Query String Parameter match.
    • options. Include this object and set the matchOperator to IS_ONE_OF, the parameterName to ab-test, and the values object to yes. This Cloudlet will be used to apply A/B testing when a request includes the query string, ?ab-test=yes.
  • criteriaMustSatisfy. Set this to all.
  • comments. Optionally add a description for the rule.
"rules": {
        "name": "default",
        "children": [
            { 
                -- All of the child rules set off of the Default Rule -- 
            },
            {
                "name": "AB Testing for A2",
                "children": [],
                "behaviors": [
                    {
                        "name": "audienceSegmentation",
                        "options": {
                            "enabled": true,
                            "cloudletPolicy": 1001,
                            -- All other options for audienceSegmentation --
                        }
                    }
                ],
                "criteria": [
                {
                    "name": "queryStringParameter",
                    "options": {
                        "matchOperator": "IS_ONE_OF",
                        "parameterName": "ab-test",
                        "values": [
                          "yes"
                        ]
                    }
                }
            ],
            "criteriaMustSatisfy": "all",
            "comments": ""
        }
        ],
        "behaviors": [
            {
              -- Behaviors set specifically in the Default Rule --
            }
        ],
        "options": { 
            -- The rest of the property settings --
        }        
    }
}

📘

If you have multiple Cloudlets set in your Ion property, include the AS Cloudlet in its own rule that's lowest in the rule order. With Property Manager, the last rule is read first. So, your AS Cloudlet rule will have priority.