Running tests server side makes it possible to run experiments on pricing or other aspects handled by your back-end. It’s also a great way to make sure there is no "flickering" at all for large changes.
1. The setup (in Symplify)
- Create a project in Symplify
- Create the number of variations you intend to have
- Setup goals (KPI's)
- Setup Audience, change to manual activation, and add an URL statement with value sg_serverside to exclude front end Audience.
NOTICE: Audience statements will not be used with server-side testing. This needs to be set up in back-end.
2. The setup on your website (server-side)
- Set your intended audience - make sure that the project only targets the visitors you want in your experiment (Audience in Symplify will not be used for targeting).
- Handle the randomization and allocation of visitors for the project (if Audience is TRUE).
- Make sure that returning visitors get the same variation as they were assigned before.
- Execute your code for changes if the visitor got the variation
Example logic ( This example is in PHP )
<?php
// Make sure the visitor match your Audience
// Check cookie, if there is no cookie for the project id then;
// Set the project ID ( Found in the Symplify dashboard )
$sg_project_id = {{ project id }};
// Randomize a variation for the project id, and set it in a cookie (To make sure the visitor sees the same variation next visit).
$sg_variation_id = [{{ original id }} , {{ variation 1 id }}, {{ variation 2 id }}];
$sg_random_variation = $sg_variation_id[rand(0, 2)];
//When visitor has variation, execute changes based on variation ID
if({{ variation 1 id }}) {
//Execute changes for variation 1
}
else if({{ variation 2 id }}) {
//Execute changes for variation 2
}
else {
//No changes - run original code
}
?>
Example logic - front end
// Symplify implementation script
<script type="text/javascript" src="https://cdn-sitegainer.com/sitegainer_123123.js"></script>
// Code for activating variation
<script>
// Create an array
var sg_force_variation = [];
// Push the project and variation id into the array
sg_force_variation.push({'project_id':<?php echo $sg_project_id?>,'variation_id':<?php echo $sg_random_variation?>});
// You could also do a for-loop in PHP to force several projects & variations.
</script>
Click the menu button (to the bottom left) to see the project ID.
Click variations and hover the different variations to see the variation ID's.
Pseudo code
// ## Include Symplify script [Front-end] ##
// In the head - load <script type="text/javascript" src="//cdn-sitegainer.com/sitegainer_XXXXXXX.js"></script>
// ## Get / Set project & variation [Back-end] ##
// Set project ID
// Check cookie, if there is a cookie for the above project id:
// Set it to variation variable
// Else
// Randomize a variation for the project id, and set it in a cookie (To make sure the visitor sees the same variation next visit).
// ## Output changes [Back-end] ##
// If variation = 0
// Original - output: "<h1>Symplify - The all-in-one platform for A/B testing & CRO</h1>";
// If variation = 1
// Variation 1 - output: "<h1>Symplify - #1 A/B testing platform in the world</h1>";
// If variation = 2
// Variation 2 - output: "<h1>Symplify - The next-generation A/B testing platform</h1>";
// ## Track outcome [Front-end] ##
// Push variation to Symplify ( sg_force_variation )
3. Check that implementation works (in Symplify)
- Open up the project in Symplify as a Preview
- Check that you only get the preview bar on pages where the project should be run.
NOTICE: You should not get a preview bar on pages where your project shouldn't run. If you do, you have not set your Audience (server-side) correctly. This however does not apply if you've implemented our callback for manual audience mode, then you will get a preview on all pages.
4. Set your goals (in Symplify)
- Set your Goals
- Check you Goals
- In Audience – choose Manual activation (at the top) and set a URL statement with the value sg_serverside.
5. Activate project (in Symplify)
Activate the project by clicking Run in the Editor.
6. Check result for project (in Symplify)
When the test is done check the results by clicking the project in the dashboard and then click View result.