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.

23 Likes

So users can’t see results (unless they have rights to use query) and this is totally for admins/background staff?

2 Likes

Yes, that is correct.

6 Likes

It doesn’t feel very practical :cry:

2 Likes

Need option to publish survey results. Otherwise better to use multiple polls.

3 Likes

Could this be presented at the topics page, so that the users can rate topics with it? Once installed, I don’t see any settings, other than the ‘Enable’ checkbox.

That would be completely outside the scope of this plugin, maybe you are looking for Discourse Topic Voting Plugin ?

Thanks, but I need users to rate 1-5 instead of vote up/down. There’s also the Topics Rating Plugin, but it requires users to click into the topic and rate inside the composer.

Hello

The sample Markdown renders in a new Topic as per below. My Discourse is updated to the latest version.

What could the the problem?

Regards

Hey @ppcole,

The above is what is shown in composer preview when you’re creating the survey. Once you create the topic it will render properly as expected.

Its not even working on my own side, sigh.

Thanks Arpit. It worked. Looking forward to enhancements

1 Like