2
votes

I am writing some code in C# for Sitecore 6.5 (Update 5) MVT, the current MVT is 100% random and admin don't have any control on the randomness of content.

I want to provide an options to admins to configure the % with the randomness. So they can configure (80%-20%) or (60%-20%-20%) or (25-25-25-25) or any combination.

The approach I am thinking is to keep a counter which then behave based on percentage. So for 80-20, every 5th visitor will get version B of content. But there are so many combination and I don't want to hard code any sequence like the one I said earlier.

I want pure results with these percentages, i.e. I don't want to send random number less than 0.2 as 20% results. This is not correct percentage as it is still more than 20% results. Refer this what I am saying.

1

1 Answers

2
votes

If you have enough visitors you could suffice with sampling randomly from a (constant) bag with items, that have the relative amount of the percentages an editor has configured ((80%-20%) or (60%-20%-20%) or (25-25-25-25) or any combination). so for 80/20 you generate a random number in the range 1..100. for anything < 80 you show version one, the rest version two. This setting can be stored as a parameter template. And the MVT logic can be implemented using a custom rule or custom presentation logic.