Hmm, great question. I’m not aware of an easy way to do this without a lot of custom coding. But you can create different A/B variants of your sticky bars. They wouldn’t rotate like you described though. Once a visitor sees a specific variant, they would keep seeing that same one. Would that work?
Yeah, I have looked at A/B testing for single sticky bars. I was going for an increase in anxiousness to click with rotating sticky bars that would grab user’s attention while interchanging. Maybe it wouldn’t increase a conversion rate, but I figured it might. Maybe someone will end up coding it! 🤣
@Zachary i wrote a script for you 😉
<script>
//getRandom will pick a random number from min to max
function getRandom(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //The maximum is inclusive and the minimum is inclusive
}
var w = window.location;
if (w.search.indexOf("offer") == -1) {
window.location = w + (w.search.indexOf("?") == -1 ? "?" : "&") + "offer=" + getRandom(1, 4); //Define here the amount of offers Eg. if 4 offers = getRandom(1, 4)
}
</script>
This will append “offer=X” to your url path every time the page loads, where X is a random number that you are gonna define by replacing getRandom(1, 4) with the range of different sticky bars you want.
After you add this script to the host page, it’s a matter of setting the targeting of each sticky bar to contains offer=1, offer=2, etc…
Let me know if this helps!
oh i just noticed that i misunderstood what you wanted… but at least you can rotate based on each time the page loads and wont show the same one like on the A/B test.
Hi @Luis_Francisco!
Thank you for this. So, rather than automatically rotating (after a few seconds), this code will produce one of the sticky bars randomly upon reloading the page? Is that right?
Zach
@Luis_Francisco awesome! Thank you for doing this, I really appreciate it 😀 😎