Page MenuHomePhabricator

Allow quicksurveys to target based on registration date
Closed, ResolvedPublic3 Story Points

Description

Background

In order to support the diversity quicksurveys epic, we would like to expand quicksurveys to be able to target by registration date of an account. This will allow:

  • continuous surveying of new editors without re-surveying the same accounts and without tracking who has been surveyed. For example, one could every month survey editors who had registered in the last month and no account would ever be surveyed twice.
    • targeting by edit count (T139317) would likely re-sample many of the same individuals for repeated surveys
  • surveying of the same cohort of editors over time to see how their motivations etc. affect the degree to which they stay or go.

Sample

I expect this to work similarly to edit count (T139317) in that the survey could be configured to target:

  • any reader regardless of their editor status: no dates provided
  • all editors who joined after a date: just start date provided
  • all editors who joined before a date: just an end date provided
  • all editors who joined between two dates: both a start and an end date provided
  • Dates only need to be as granular as a single day (e.g., 2018-03-19). Dates should be inclusive to match how T139317 works.

Developer notes

mw.user.getRegistration() should be used to get the user registration as Date object.

QA steps

A survey has been setup to show for users who registered in March 2019
In an incognito window using the DESKTOP site:

  • Verify user Edtadros does not see the survey (registered 2 months ago)
  • Verify user The_E does see the survey (registered in March)
  • Create a new user and verify they do not see the survey (registered in April)
  • An anonymous user should not see the survey (no registration date)

QA Results

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 14 2019, 2:56 PM
ovasileva triaged this task as High priority.Mar 14 2019, 2:56 PM
Isaac added a subscriber: Isaac.Mar 19 2019, 2:11 PM
Isaac updated the task description. (Show Details)Mar 19 2019, 2:44 PM

How are we planning to obtain registration date in JS?

pmiazga added a comment.EditedMar 29 2019, 6:28 PM

@Jdlrobson there is a function mw.user.getRegistration() that returns user registration as Date object.

pmiazga added a comment.EditedMar 29 2019, 6:41 PM

@ovasileva @Isaac couple questions regarding this task (mostly just to clarify things):

  1. are registeredBefore and registeredAfter stored in ISO 8601 format ok for you? Todays date ( Fri Mar 29 2019 ) would be stored as 2019-03-29
  2. I want to clarify the the sample: "all editors who ". This is task is just to provide checking user registration date checks. To verify that the user is an editor (my understanding: has some edits) who joined after some date it will be possible by specifying both registeredBefore:2019-03-29 and minEdits:1. The registeredBefore and registeredAfter checks will not check that user has some edits. Only the user registration date. is it ok?
  3. Are registeredAfter and registeredBefore inclusive? eg, what to do if the user registered on 2019-03-28, and Survey Audience is set to registeredAfter: '2018-03-28', hide the survey? Sorry, I just found info that dates should be inclusive.
Isaac added a comment.Mar 29 2019, 6:59 PM

Hey @pmiazga

are registeredBefore and registeredAfter stored in ISO 8601 format ok for you? Todays date ( Fri Mar 29 2019 ) would be stored as 2019-03-29

Yes, that'd be perfect. Thanks!

I want to clarify the the sample: "all editors who ". This is task is just to provide checking user registration date checks. To verify that the user is an editor (my understanding: has some edits) who joined after some date it will be possible by specifying both registeredBefore:2019-03-29 and minEdits:1. The registeredBefore and registeredAfter checks will not check that user has some edits. Only the user registration date. is it ok?

Yes - I expect that including a user registration date will not invoke any logic around number of edits. That is, including user registration date would limit the survey to logged-in users whose account creation date matches the criteria, but edit count would be used separately if we wanted to be explicit about people with at least one edit etc.

Are registeredAfter and registeredBefore inclusive? eg, what to do if the user registered on 2019-03-28, and Survey Audience is set to registeredAfter: '2018-03-28', hide the survey?

For ease of us remembering how it works, I think it should match edit count (T139317), where the criteria are inclusive. So in your example, setting registeredAfter to 2018-03-28 would include a user who registered on 2019-03-28. And if the criteria was instead registeredBefore set to 2018-03-28, that would also include the same user. If that seems like an odd interpretation for "before" and "after" (which tends to suggest exclusive to me), maybe the variable names could be more like registrationStart and registrationEnd?

@Isaac thank you for quick reply. Everything is clear now. Thanks. Also, registrationStart and registrationEnds sounds like much better names. I'll use those instead of registrationBefore and registrationAfter.

Change 500107 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/QuickSurveys@master] Introduce registrationStart and registrationEnd audience checks

https://gerrit.wikimedia.org/r/500107

pmiazga removed pmiazga as the assignee of this task.
pmiazga added a subscriber: pmiazga.

Change 500107 merged by jenkins-bot:
[mediawiki/extensions/QuickSurveys@master] Introduce registrationStart and registrationEnd audience checks

https://gerrit.wikimedia.org/r/500107

Jdlrobson updated the task description. (Show Details)

@Jdlrobson Those are some seriously personalized QA steps!

Edtadros reassigned this task from Edtadros to Jdlrobson.
Edtadros added a subscriber: Edtadros.

Test Result

Status: ❌ FAIL
OS: macOS Mojave
Browser: Chrome

Test Artifact(s):

❌ AC1: Verify user Edtadros does not see the survey (registered 2 months ago)
I get this message when I log in:

Then when I go to a random page I see the following:

✅ AC2: Verify user The_E does see the survey (registered in March)
I still see this message when I login

But I also see the survey so that's good.

✅ AC3: Create a new user and verify they do not see the survey (registered in April)

✅ An anonymous user should not see the survey (no registration date)

@Edtadros AC1 and AC2 -> this is our env misconfiguration (CentralAuth plugin), it's not related to the QuikcSurveys extension. When you log in, please go back to testing urls manually. Sadly once you login, it cannot properly redirect you back to the site.

Make sure to use https

@Jdlrobson and @pmiazga thanks for your help. I should have been clearer. I only included the "Central user log in" page as informational because I don't recall seeing it before. I am still seeing the survey for AC1. That is the reason I failed. I did try again with HTTPS and sure enough I don't see the "Central user log in" page, but I am still seeing the survey.

Test Result

Status: ✅ PASS
OS: macOS Mojave
Browser: Chrome

Test Artifact(s):

✅ AC1: Verify user Edtadros does not see the survey (registered 2 months ago)

✅ AC2: Verify user The_E does see the survey (registered in March)

✅ AC3: Create a new user and verify they do not see the survey (registered in April)

✅ An anonymous user should not see the survey (no registration date)

Edtadros updated the task description. (Show Details)Apr 2 2019, 10:24 PM
phuedx updated the task description. (Show Details)Apr 4 2019, 2:13 PM
ovasileva reassigned this task from ovasileva to Isaac.Apr 8 2019, 10:20 AM

Looks good to me, handing over to @Isaac for the final review

Isaac updated the task description. (Show Details)Apr 8 2019, 5:55 PM
Isaac closed this task as Resolved.

Looks good to me! Thanks team!