I am showing a fancybox modal window when a visitor leaves the site. It is working correctly. But as a split test, I want to show visitors random content from 2 different divs on subsequent visits.
Meaning:
1) When visitor 1 comes and tries to leave site, he might see fancybox with content 1 or 2
2) When visitor 2 comes and tries to leave site, he might again see fancybox with content 1 or 2
And so on...
The actual code for the fancybox modal is:
<div id="inline" class="various2" style="display:none;">
<div style="padding:20px;">
This is the content of that shows inside the fancybox modal.
</div>
</div>
Now for the inner div, i want to put another div with some different content, and one of them should randomly show on every page load, while the other is display:none...
I have tried this: How to show one div of many, per page refresh? But it doesn't work and shows both divs visible...
Can anyone help?
EDIT: The original question is answered. Now, how can I show alternate div on every page load. Not random. Something like visitors 1,2,3,4 see divs 1,2,3,4 respectively.
I know this would require some server side code, can anyone help with some basic php code?