Discourse Surveys

:discourse2: Summary Discourse Surveys plugin allows you to create surveys directly within your Discourse forum posts using simple Markdown syntax.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-surveys
:open_book: Install Guide How to install plugins in Discourse

The Discourse Surveys Plugin allows you to create surveys directly within your Discourse forum posts using simple Markdown syntax. The plugin currently supports a variety of question types such as radio buttons, checkboxes, dropdowns, number inputs, text areas, star ratings, and thumbs up/down ratings.

Basic Survey Markdown

Here is a basic example of survey Markdown including all available fields:

[survey name="awesome-survey-thumbs" title="Awesome Survey"]

[radio question="Choose any one option:"]
- cat
- dog
[/radio]

[checkbox question="Choose multiple options:"]
- red
- blue
- green
[/checkbox]

[dropdown question="Gender:"]
- Male
- Female
[/dropdown]

[number question="Rate this survey from 1 to 10:"]
[/number]

[textarea question="What is your feedback about xyz?" required="false"]
[/textarea]

[star question="How would you rate overall experience?"]
[/star]

[thumbs question="Were you satisfied with our services?"]
[/thumbs]

[/survey]

Survey Rendering

Below is an example of how the above Markdown renders in Discourse:

Survey Results

Currently, this plugin does not have any backend UX to view the survey results directly. Instead, you can rely on Data Explorer queries to fetch and analyze survey responses. Here is an example query:

-- [params]
-- text :survey_name = survey

SELECT s.id, s.name, s.post_id, sf.question, COALESCE(sr.value, sfo.html) AS value, sr.user_id, sr.created_at as responded_at
FROM surveys s
JOIN survey_fields sf ON sf.survey_id = s.id
JOIN survey_responses sr ON sr.survey_field_id = sf.id
LEFT JOIN survey_field_options sfo ON sfo.id = sr.survey_field_option_id
WHERE s.name = :survey_name
ORDER BY s.id DESC

Event Integration

This plugin also integrates with the events plugin to show or hide the survey at specific dates and times.

Future Scope

The plugin has potential for many improvements. Feel free to join the discussion, and submit pull requests on the pluginโ€™s repository.

26 Likes