In the context of T253112: Create survey for TechWish prototype announcements on dewiki and metawiki, WMDE Technical Wishes decided that we want to run a survey but only display on a single page. We planned to mostly reuse the QuickSurveys visual design and response connection mechanisms. After experimenting with a single-file Javascript implementation, I realized that "upstreaming" and attempting to integrate our new feature directly into QuickSurveys would be the most effective use of resources.
Please consider our submitted patches for your codebase :-)
- patch - Gracefully degrade when survey configuration is invalid. This allows for safe migration and potential rollback.
- patch - Add a new survey type for embedding in a page
The basic idea is that, "embedded" surveys are only available on pages which include a matching embedding element. All other selection criteria remain the same. If selected for display--which will be the usual case, as we expect to run them at 100% for those pages--the survey will replace the embedding element.
Another new behavior is that we currently want to offer an arbitrarily long list of multi-select answers. I've implemented so that the embedded surveys will always have this format, but I can imagine that in future (unplanned) work we would want to abstract the survey format so that either format can be used with either the floating "internal" survey, or the positioned "embedded" survey type.
Screenshot: