The Wikidata team and the Wikimedia Exec are interested in running surveys that could target:
* Editors only
* Editors with certain edit counts
** ~~Bucketed in the same way that we do with [[ https://meta.wikimedia.org/wiki/Schema:Popups | the Popups schema ]] (see the `editCountBucket` property)?~~ @Jdlrobson points out that this is already the case.
* Non-editors only
## AC
A survey can be configured to:
[] Target a non-editor (`wgEditCount === 0`)
[] Target an editor
[] Target a user with an edit count that falls into one of a set of predefined buckets, e.g. 5-99 edits
### Descoped
[] The user's bucketed edit count will be recorded when the user answers the survey.
Right now this can only happen for InternalSurvey's. I'm not sure if it's needed for ExternalSurvey's but if it is, this is quite a significant change and requires its own task.
##Notes
# Answers to "internal" surveys are recorded via [[ https://meta.wikimedia.org/wiki/Schema:QuickSurveysResponses | the QuickSurveysResponses schema ]].
## Developer notes
The users bucketed edit count is already inspected and recorded in the schema, so this change would only need to update the behavior for showing the survey.
To support this kind of surveys we'd need to add an optional field to a survey definition inside QuickSurveysConfig that sets a minimum edit count.
This field would then need to be inspected inside the [[ https://github.com/wikimedia/mediawiki-extensions-QuickSurveys/blob/master/resources/ext.quicksurveys.lib/lib.js#L229 | showSurvey method ]].
Given the team hasn't worked on this code, there is likely to be an added tax as we regain familiarity with the codebase and how it works including setup/testing which may bump the estimation.
While working on this code, it might be a good opportunity to modernise some of the code - for instance replace $.each usages with Array.prototype.forEach.
## Comments
@JKatzWMF: If it's trivial, being able to target by edit bucket would also be very useful for future surveys (on {T197631}).
## QA steps
**Make sure to test these on __desktop site__. There is a bug with mobile (T218243)!**
A survey has been setup to only show for users with edit count between 1 and 22
Visit https://reading-web-staging.wmflabs.org/wiki/Test_the_diff in an **incognito window**
- Verify the survey doesn't show if you are logged out
- Verify the survey doesn't show if you are logged in and have an edit count of 0
- Verify the survey DOES show if you are logged in and have an edit count of 1
- Verify the survey DOES show if you are logged in and have an edit count of 20
- Verify the survey doesn't show if you are logged in and have an edit count of 23
Survey should look like
{F28377006}