You can easily A/B test an email or landing page in Mautic, and with a little effort you can even A/B test a Campaign. But how would you A/B test a dynamic web content? I created a short video to explain just that. It also shows you how to assign an ever changing random value to a contact.

When you use this solution, please remember, that it will add a bunch of entries to your contact history. Make sure you only use it on the landing page or squeze page.

Here is the video:

And here is the script I’m using in the video:

<script>
// Generate a random value of 0 or 1 for random_ab
var random_ab = Math.random() < 0.5 ? true : false;

// Send the pageview with the random_ab variable
mt('send', 'pageview', { random_ab: random_ab });

// Log the value to the console for debugging
console.log('added: ' + random_ab);
</script>

<div data-slot="dwc" data-param-slot-name="versionA">
</div>

<div data-slot="dwc" data-param-slot-name="versionB">
</div>

Very very important: make sure you use not the same browser for testing the result as the browser, where you are logged in as admin. Otherwise Mautic will not render the proper result for you.

Leave a Reply

Your email address will not be published. Required fields are marked *