One of the most exciting abilities with Cloudflare Workers is the ability to run AB tests - and we’ve enabled this through Sloth. We’re actually running a live example of this on https://dantaylor.online/sloth-ab at the moment - and this example is used throughout this “how to” guide.
How to set-up an AB testing campaign
When logged into your Sloth dashboard, you need to select AB testing from the sidebar menu on the left hand-side. And then you need to click on “Add campaign”.
When you’re first setting up a campaign, you’ll be met with a screen like this:
And this is the interface for setting up an AB testing campaign. Once it’s completed it will look something like this:
These fields are:
- The name of your AB testing campaign. This only appears in Sloth.
- This code is for user cookies.
- This is the URL that you want users to go to and then be redirected. This doesn’t need to be a real URL or resolve in a 200.
- Choose between Shadowed and Redirected. Shadowed tests proxy primary URL to variations, whilst Redirected tests 302 redirects to variations.
- Choose your traffic split, either custom or even. If you choose custom, the split total in the row manager must equal 100.
- Enter the URLs of your variation pages. These should be the pages you want to AB test, they can include parameters. If you’re testing one page against another, you should include it as a variant.
- You can enable or disable URLs as part of a test, or scrap them.
Reporting on edge AB tests
Whilst a lot of AB testing platforms have reporting dashboards, you’re running this test through a serverless application on a CDN.
In order to manage reporting, you need to use your analytics package, for example Google Analytics:
You can also set-up a Google Data Studio report fairly easily with your landing page paths and in-built analytics goal conversions to monitor AB testing through Sloth at scale - and with ease.