By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,481 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,481 IT Pros & Developers. It's quick & easy.

Pop Up Frequency

P: 1
Hi there:

I'm not a developer but I work for a market research company who specialise in online surveys. We have a requirement from a client to build a pop up survey which they can place on their site to invite a random selection of their users to the questionnaire. However, in order not to annoy their customers, they only want the pop up to appear around 20-30% of the times the homepage is loaded, not every time. Also once a user has completed the survey, we don't want them to be able to complete it again.

I have had a look online at some freely available popup scripts and some pop up script software, but none seem to offer the "pop up frequency" functionality I am looking for. Either the popup will display once per session, or once per x minutes, which is not what I want. I know this percentage frequency is possible as we used to have this functionality with another survey software we used to use, but I don't have access to the popup script they used to make the popup.

Any help on scripting this or suggestions would be appreciated.
Jul 30 '08 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
However, in order not to annoy their customers, they only want the pop up to appear around 20-30% of the times the homepage is loaded, not every time.
This won't be possible with JavaScript unless you're talking about one user only.
Also once a user has completed the survey, we don't want them to be able to complete it again.
This should be possible by setting a cookie. Read the cookie on page load. If set, do not display the popup.
Jul 30 '08 #2

hsriat
Expert 100+
P: 1,654
However, in order not to annoy their customers, they only want the pop up to appear around 20-30% of the times the homepage is loaded, not every time.
This is possible. When we talk about "around 20-30%" we have to consider probability. So let the function which is used to display popup be dependent on a simple mathematical statement.
Expand|Select|Wrap|Line Numbers
  1. var chances = Math.floor(Math.random() * 100);
  2. if (chances <= 25) // there are 25% chances for this to be true
  3. showPopup(); // function to display popup
Jul 30 '08 #3

acoder
Expert Mod 15k+
P: 16,027
You're probably right, but it depends if it's for a particular user or any time the page is loaded for all users.
Jul 30 '08 #4

hsriat
Expert 100+
P: 1,654
You're probably right, but it depends if it's for a particular user or any time the page is loaded for all users.
uummmm.. I don't think it has any dependencies like you said, but yes, you can't be 100% sure that out of 100 users, exactly 25 users would get the popup. But I think this is the closest possible solution.
Jul 30 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Ah right, I see what you're saying. I guess you could have it at 20-30% for each individual user perhaps by setting a cookie when a popup is shown once to fix it. You could fix it at 25% by showing it once every four times, though I personally hate popup windows, but that's a different story.
Jul 30 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.