Page MenuHomePhabricator

QuickSurveys: Show a survey to readers arriving from Discord via wprov link parameter
Open, Needs TriagePublic

Description

We want to serve a QuickSurvey to readers arriving on articles from Discord preview links, so that we can learn how Discord users perceive Wikipedia on that platform. Inbound links from Discord carry a provenance parameter (https://wikitech.wikimedia.org/wiki/Provenance) specific to this feature (wprov=diim1). Only a configurable sample of qualifying readers will see the survey, and it must impose no cost on readers who cannot see it.

Technical notes

The wprov param is stripped from the URL client-side by mediawiki.page.ready and is not visible to PHP (it is excluded from the CDN cache key by design). MediaWiki core now exports the stripped value from mediawiki.page.ready so dependent modules can read it (https://gerrit.wikimedia.org/r/1307856, merged).

No changes need to be made to QuickSurveys itself: the extension is in maintenance mode, and the earlier approach of adding an audience.wprov key there (https://gerrit.wikimedia.org/r/1307888) was reverted (https://gerrit.wikimedia.org/r/1308195). Instead, all Discord-specific logic lives downstream in WikimediaCustomizations (https://gerrit.wikimedia.org/r/1310639), alongside the code that generates the preview links and their wprov value (both read from $wgWMCDiscord).

Acceptance criteria

  • A survey defined in WikimediaCustomizations displays to readers who land on an article with the configured Discord wprov value, sampled at $wgWMCDiscord['surveyCoverage'], and can be enabled/tuned per wiki via configuration alone (https://gerrit.wikimedia.org/r/1310639)
  • Enabling the survey ships no QuickSurveys code to readers who are not eligible
  • The client-side visibility of wprov and the diim1 value are documented at https://wikitech.wikimedia.org/wiki/Provenance

Event Timeline

egardner renamed this task from [Discord] Launch Quicksurveys for (some) in-bound visits to QuickSurveys: Show a survey to readers arriving from Discord via wprov link parameter.Jul 6 2026, 9:21 PM

Change #1307856 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] mediawiki.page.ready: Add "wprov" to exports

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

Change #1307888 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/QuickSurveys@master] Add wprov targeting to survey audiences

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

Change #1307890 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/ReaderExperiments@master] Add QuickSurvey for readers arriving from Discord

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

Change #1307891 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/extensions/ReaderExperiments@master] [DNM] Enable Discord survey by default for patchdemo

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

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://87785a5239.catalyst.wmcloud.org/w/

Change #1307856 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.page.ready: Add "wprov" to exports

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

Change #1307888 merged by jenkins-bot:

[mediawiki/extensions/QuickSurveys@master] Add wprov targeting to survey audiences

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

Krinkle added subscribers: matmarex, Krinkle.

Change #1307856 merged by jenkins-bot:

[mediawiki/core@master] mediawiki.page.ready: Add "wprov" to exports

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

After @derenrich approached us at T428527, we intentionally omitted a return/export mechanism. Bartosz wrote the following recommendation there:

Regarding preserving the value, or making it available to other code: I think it's important to note that the value is not available to server-side (PHP) code, since it's stripped in Varnish, so it seems surprising to me to support client-side (JS) code using it. Personally I would just invent a new parameter specific to your project and set it alongside wprov, and leave that one to be used only for analytics. Whatever you do, please document it at https://wikitech.wikimedia.org/wiki/Provenance afterwards :)

I'll note that readers may people find it surprising, after clicking a URL with no clear and visible "discord" parameter and no informed consent through cookies or otherwise, if there is a direct acknowledgement that they came from Discord. The widespread of use of referral headers and UTM parameters on the web can be equally surprising to people when they learn of it, but this generally only acted on in aggregate, and this surprise rarely manifests because most websites (including those less reputable than Wikipedia) generally don't draw attention to it in the user interface.

I trust that this has been considered and weighed, but this isn't reflected in the task or public plans that I could find. If it was considered and talked about elsewhere publicly already, it may be worth linking to or repeating here so that others may easily find it through Phab search from this task. For example: Is the survey itself is more generically phrased and only triggered for wprov=discord, or the invisible parameter specifically desired for the UX of this survey, or is it a trade-off downstream from reusing wprov, or is it required for some other reason? (i.e. cache performance).

The survey and campaign systems around MediaWiki use various parameters for its functions already, e.g. with a parameter like ?survey=discord or ?campaign=discord such in UploadWizard, ContentTranslation, Account Creation, and MobileFrontend.

Change #1307888 merged by jenkins-bot:

[mediawiki/extensions/QuickSurveys@master] Add wprov targeting to survey audiences

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

Note: This was reverted for unrelated reasons in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/QuickSurveys/+/1308195.

Thanks for raising these questions, @Krinkle. Addressing them below.

The survey itself is generic. The question will be some version of "Why did you come to Wikipedia today?" with multiple-choice answers, none of which mention where the reader came from. The UI does not acknowledge the user's origin; provenance only gates who's eligible to see it. The idea is that the same survey could be reused for future experiments around embedded Wikipedia previews on other platforms. Only a subset of eligible users will actually be presented with the survey (via the coverage mechanism in QuickSurveys).

Regarding wprov vs. a new parameter (Bartosz's suggestion): we may run similar surveys for other platforms in the future. Each one would then need two parameters per link — wprov for analytics plus a targeting param — and new client-side scrubbing logic for each targeting param we introduce. That seemed less than ideal. I could also see users being confused by a ?survey=discord parameter that only sometimes triggers an actual survey. There is also the issue of cache fragmentation, but that's admittedly a minor concern at this stage.

On privacy: no new data is being collected. The client-side read lasts only for the pageview, isn't persisted, and isn't tied to any identifier. The only actual data collection is the survey response, which goes through QuickSurveys' existing consent and privacy-statement flow. The team has reached out to legal to ensure that we have an appropriate privacy policy here.

Finally, on process: I'm new to this project and wasn't part of the earlier discussions, though I did read T428527 and Bartosz's recommendation. I posted these patches to re-open a discussion. When the core patch was +2ed I took that as a sign that exporting wprov and using it in a context like this was generally acceptable. If that's not the case then I'm open to alternative approaches. The tools we have to understand logged-out user behavior are pretty limited, and this seemed to me like usage that while novel was still in line with why the provenance param exists in the first place.

Assuming we do continue with this approach, I'm happy to document the client-side visibility of wprov (and this use case) at https://wikitech.wikimedia.org/wiki/Provenance so this is discoverable outside of this task.

egardner updated the task description. (Show Details)

I've updated the task description to reflect the current approach.

Test wiki on Patch demo by EGardner (WMF) using patch(es) linked to this task was deleted:

https://87785a5239.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://6ef6f5fa52.catalyst.wmcloud.org/w/

Hey @Krinkle, we spent some time Monday speaking with Halley and Moriel, and again in the meeting this morning (which I know you attended as well) and we are hoping that we are good to go with this for the short term, especially since the Discord use case is pretty imminent. There will of course need to be a medium and longer term solution for this, and Damian and are actively investigating those, but curious if we can unblock development at this stage?

Test wiki on Patch demo by EGardner (WMF) using patch(es) linked to this task was deleted:

https://6ef6f5fa52.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by EGardner (WMF) using patch(es) linked to this task:
https://eec861074c.catalyst.wmcloud.org/w/

Change #1310639 merged by jenkins-bot:

[mediawiki/extensions/WikimediaCustomizations@master] Discord: Add QuickSurvey for readers arriving via preview links

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

Test wiki on Patch demo by EGardner (WMF) using patch(es) linked to this task was deleted:

https://eec861074c.catalyst.wmcloud.org/w/

Change #1338439 had a related patch set uploaded (by Eric Gardner; author: DErenrich):

[operations/mediawiki-config@master] Enable discord preview extension code on testwiki (tk 2)

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

Change #1338439 merged by jenkins-bot:

[operations/mediawiki-config@master] Enable discord preview extension code on testwiki (tk 2)

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

Mentioned in SAL (#wikimedia-operations) [2026-09-10T21:33:41Z] <derenrich@deploy1003> Started scap sync-world: Backport for [[gerrit:1338439|Enable discord preview extension code on testwiki (tk 2) (T437344 T431352)]]

Mentioned in SAL (#wikimedia-operations) [2026-09-10T21:37:52Z] <derenrich@deploy1003> derenrich: Backport for [[gerrit:1338439|Enable discord preview extension code on testwiki (tk 2) (T437344 T431352)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-09-10T21:47:03Z] <derenrich@deploy1003> Finished scap sync-world: Backport for [[gerrit:1338439|Enable discord preview extension code on testwiki (tk 2) (T437344 T431352)]] (duration: 13m 23s)