here the sample case..
i want to display banner randomly by percentage based on visitor hits.
for example i want to display ads 70% of visitor hits..
the problem is we don’t know how many visitor is.
if it make easier we have set percentage 10%, 20%, 30% … 100%
- and maybe also possible if we save counter per 100 hits and reset
Thanks in advanced.
You don’t need to know about how many visitors. The only thing you need to do is take a random number between 1 and 100, and if it is 70 or lower, it is within this 70% range.
Eventually this will work out, and display the banner to 70% of the people:
If you want to keep this number, and show it to the user for all page views, then store it in a $_SESSION var of some sort, and based on that value display the banner.