This is a sample of PHP code with the purpose to enable AB testing server side. With this code, you should be able to AB test changes, on the server side, before the page has been served to the browser.
This code will require that you create a normal Convert AB experiment, and do a small change on it, to be able to save it.
// This is the variation.
With that change, you should be able to save it, and use that experiment to collect data, and analyze it using its report.
Make sure you enter a condition that wont be able to be triggered in the test. You could just use a JS Condition with the value false to never trigger it another way.
This is way more efficient than getting them via an API, as this would delay the processing of the code. However, if this is what you need, we have an API available for you to use.
If you have any questions, let them us know through the support channels available to you.