Please help us improve our website.
July 29, 2005 7:18 AM   Subscribe

I'm in the final stages of setting up a user survey for my website and wanted to ask a cookie/javascript question.

The current set up is this: a DHTML window will kindly ask visitors to click through to a survey, with a setTimeout of 2 minutes, so I can have visitors actually go through the site beforehand. There is also a session cookie so visitors don't get the popup more than once per visit.

However, the site has more than one page, and this script is rendered useless unless the visitor stays on the same page for 2 minutes (not likely). Is there a way I can introduce a site cookie or any other method that would initiate the javascript after 2 minutes, regardless of which page the user clicks through?

The only solution I found so far is having a dummy window open in the background with the setTimeout, but I don't want any other popups (and they would be likely blocked, anyway). Hopefully someone with more technical knowledge than me will have a solution to this dilemma.
posted by Blue Buddha to Computers & Internet (7 answers total)
 
The pseudo-code logic might run something like this:
document.onload, check for surveyCookie
if surveyCookie doesn't exist{
var enteredTime = now
set surveyCookie = enteredTime
}else{
var enteredTime = surveyCookie
}

var remainingInterval = (enteredTime + 2minutes) - now;
set window to pop up after remainingInterval
If someone else wants to make that into actual javascript...
posted by 4easypayments at 7:38 AM on July 29, 2005


4easypayments' method assumes that you have control over whatever page the user is examining after they've left your initial page.

You could try and create your site in a framed document, where the rows of the frameset are denoted as "100%,*" with no bordering or margins. That way, there's a frame on the page that's completely unseen, and the user doesn't experience a difference in navigation. The only flaw in this method is if the user navigates by some other method than using the links on the page (i.e. via bookmarks or the address bar). If they end up leaving the site by one of those methods, you're once again SOL.

The popunder or hidden window is probably your best bet, but any popup blocker worth its salt is going to kill that idea.
posted by thanotopsis at 8:05 AM on July 29, 2005


No, you just have to add 4easypayments' logic to EVERY page. maybe with auto_prepend in your root .htaccess or httpd.conf (assuming you are running on apache)

Also, why not do this logic server-side, so that people browsing without javascript turned on still get your survey?
posted by misterbrandt at 8:36 AM on July 29, 2005


Response by poster: misterbrandt, if you know a good resource on how to do it using ASP, please link it. Thanks.
posted by Blue Buddha at 8:39 AM on July 29, 2005


Oh, it is JS because it's a dhtml "window" not a popup window. never mind that last bit then
posted by misterbrandt at 8:48 AM on July 29, 2005


Blue Buddha, ASP / IIS is not my thing. Sorry. And my google-fu for the MS equivalent of auto_prepend failed me. utterly.
posted by misterbrandt at 9:00 AM on July 29, 2005


If you're on IIS, I think you should modify the global.asa file with that script. Here is a link to the w3Schools explanation of the file, which is, unfortunately, completely in VBScript.
posted by creeront at 10:57 AM on July 29, 2005


« Older What theme is this?   |   You see, the Square Master allows you to maximize... Newer »
This thread is closed to new comments.