Topic on Extension talk:Survey/Flow

Prevent survey from appearing on all pages

7
193.120.46.241 (talkcontribs)

Hi Jeroen,

I was wondering if it is possible to prevent the survey from appearing accross all Wiki pages?

We wish to use MediaWiki to provide a Wiki across our international sites. I would like to avoid creating a separate Wiki for each geographical location, we wish to unify our staff with one communication portal. However we would like to publish surveys that are only relevant to each site.

In its current implementation once we publish a survey it appears for all users. I was wondering if it was possible to disable/enable the surveys on specific pages only. In this manner we could direct relevant staff to a particular URL where they wouldbe prompted to complete a survey relevant to them.

Thank you for your work in creating the survey.

Regards,

John.

Jeroen De Dauw (talkcontribs)
81.105.166.145 (talkcontribs)

Hi Jeroen,

I've tried the newly documented <survey> tag, but it seems not to appear for all users. I've created several dummy accounts and it only appeared for one. I've looked at the code, but I can't work out how the system decides who to show they survey to. I've tried hacking the DB to remove prior submissions, but that does not work. I absolutely need it to be shown to all registered users, ideally with the ability to re-do at any time.

Any pointers apprecieted.

Cheers, Jason.

Jeroen De Dauw (talkcontribs)

A cookie is used to keep track of if you took the survey. Using multiple accounts via the same browser w/o clearing the cache will therefore have that result.

81.105.166.145 (talkcontribs)

Hi Jeroen, I thouoght this was the case, but could not find where it was creating the cookie. Now I realise that the PHP end of things is pretty dumb, with most of the processing being done clientside in JS. I would suggest it would be better to use the logged-in userid in PHP to query the DB for past submissions, rather than relying on cookies. The problem is hotdesking and shared PCs....This means people get requested to complete surveys they've already done if they hotdesk and never get ones others have alreay completed on the same shared PC.

There is also an issue with using a cookie in this way that might explain other problems people are having. When you first visit a survey page the survey is 'completed' by creating a cookie, regardless of if the user actually fills in the form or presses SEND. If their session is aborted for any reason the cookie is created regardless. Which means they never get the request again for a month....

I think the PHP side of things needs to be better. I'll look to see if there is a simple solution, though I've done very little mediawiki programming and even less Javascript...

Cheers, Jason.

Jeroen De Dauw (talkcontribs)

Hitting the db will only help when you require users to login, which is a restriction I do not want to put in the extension. In general the current setup works just fine, but I agree it does not work in your use case. The JS is actually based on what is done on Wikipedia with the banner campaigns.

> When you first visit a survey page the survey is 'completed' by creating a cookie, regardless of if the user actually fills in the form or presses SEND.

Indeed. In some situations you want this, in others you don't. Rather then changing this, I'd introduce another setting.

64.88.197.154 (talkcontribs)

Regarding the note "that using the survey tag is an experimental feature which might not work properly in all situations", I've cloned REL1_22, should I expect this feature to work?

Reply to "Prevent survey from appearing on all pages"