Page MenuHomePhabricator

Organizer can toggle on collaborative contributions for qualified events (nice to have for MVP)
Closed, ResolvedPublic

Description

NOTE: Not a hard requirement for patchdemo release, but a hard requirement for release to prod wikis.
User story:

As an organizer, I want to be able to choose if collaborative contribution data is collected for my event, so that I can report on impact when wanted and keep contribution data more private when not wanted.

Acceptance Criteria:
  • Given that an organizer has created an event that focuses on contributions (i.e., Editing event, Media upload event, Backlog drive or Contest selected as at least one option in "Event type"),
    • And if hybrid or in person, it is not in a country that is considered "no publish" or "high risk" (see list)
      • The organizer should see the option to toggle on "Show contribution statistics," with the following helper text: "Enable contribution statistics, so that you can share and understand the impact of the event. A summary and full list of edits is provided."
        • And this toggle should be placed between Participation Options and P&E Dashboard link
        • And it should be toggled on by default
    • And if the organizer tries to enable contribution tracking for an invalid event type,
      • They should see the following error message: "Contribution statistics can only be enabled for events with the following types: <list>"
    • And if the organizer tried to enable contribution tracking for an invalid country,
      • They should see the following error message: "Contribution statistics cannot be enabled for the selected country."
  • And the API endpoints (enable/edit/get registration) should have equivalent functionality and be documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents/Api
  • The CampaignEventsContributionTrackingDisallowedCountries config flag is documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents#Parameters

Screenshot 2025-08-21 at 2.45.21 PM.png (294×1 px, 47 KB)

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
ifried added a subscriber: JFernandez-WMF.

@JFernandez-WMF, when you get a chance, can you add designs to this ticket? Thank you!

Potential design changes:

  • Move event type below event topic, so that if people want to toggle on/off collaborative contributions, they can see it right above P&E Dashboard. This makes it more clear that collaborative contributions is another tracking tool, and people can choose to use one of the two tracking options or both of them for their events.
  • We should make the toggle default on
  • Add "(Optional)"

Things to consider:

  • Do we want to have a separate section for "Contribution insights" that features both collaborative contributions & P+E Dashboard, but it shares the differences too?
ifried renamed this task from Organizer can toggle on collaborative contributions for qualified events to Organizer can toggle on collaborative contributions for qualified events (nice to have for MVP).Aug 26 2025, 7:19 PM

Change #1183115 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Add contribution tracking flag to event entity and storage layers

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

@ifried @JFernandez-WMF For this AC:

And the toggle should appear above the P&E Dashboard field

Is this outdated? If we put the toggle after event types, there are going to be both event wikis and event topics between it and the P&E Dashboard.

Also checking in on the copy of the label and help text, to confirm if it's final. In particular, the label would not include the "(Optional)" tag, as that's a Codex feature but this form uses OOUI (where required fields are marked with an asterisk instead).

Also noting that (at least in OOUI) the toggle will be before the label, i.e.

image.png (347×1 px, 59 KB)

Change #1183123 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] [WIP] EventFactory: implement contribution tracking validation

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

And a couple more things:

  • The list will need to be kept up-to-date manually if there are any changes
  • We need error messages for when someone tries to enable contribution tracking for an event in a forbidden country. Suggestion: Contribution tracking cannot be enabled for the selected country
  • Maybe for a future task, it's worth considering how we can more proactively prevent an invalid form submission (that is, currently you only learn that the country is invalid the moment you submit the form)

Change #1183144 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[operations/mediawiki-config@master] Configure high-risk countries for CampaignEvents

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

Change #1183121 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] [WIP] Let organizers enable contributions tracking

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

Hi @Daimona,

I am discussing the questions above with @JFernandez-WMF, and here's some responses/ideas:

Placement of the collaborative contributions toggle: There are 2 things we need to consider - 1) We want the collaborative contributions toggle to be placed by the P&E Dashboard link, so there is a thematic connection between tracking options available, and 2) We need to know the country of the event (if in person/hybrid) and event type (if editing event) in order to enable contribution tracking as an option. For this reason, the general proposal should be that we have the following order:

  • Everything is the same from Event page to Organizers
  • Does this focus on specific wikis?
  • Event topics
  • Event type
  • Participation options (which will include country, if any)
  • Toggle for collaborative contributions tracking
  • P&E Dashboard link
  • Group chat invite to test/live wiki remains the same

Does that work? Any thoughts?

Language/final copy:

Thanks for checking in on this! Yes, it may be better to avoid words like "tracking," and instead say something like "contribution statistics" or "contribution impact." @JFernandez-WMF will look into this and provide some language suggestions in the next day or two.

Optional in parentheses: Yes this can be removed, if it is does not conform with existing standards.

Toggle before the label: Yes, this is fine.

The list will need to be kept up-to-date manually if there are any changes: You mean that the order of the fields will be need to be maintained manually? If that is the case, is that okay? Any concerns?

We need error messages for when someone tries to enable contribution tracking for an event in a forbidden country. Suggestion: Contribution tracking cannot be enabled for the selected country: Yes, suggested text approved. Will add to AC. One note is that, if we pick some final language that says something like "Enable contribution statistics..." we can also tweak this text to say something like "Contribution statistics cannot be enabled for the selected country." Decision on this should come soon.

Maybe for a future task, it's worth considering how we can more proactively prevent an invalid form submission (that is, currently you only learn that the country is invalid the moment you submit the form): Yes, maybe. But another thing to consider is that our prevention of events in certain countries not being able to use collaborative contributions is, potentially, a short-term measure. We do have a way to support those events (i.e., only show data to organizers, the editor, and admins) but we have deprioritized that for the MVP. So, yes, something to consider later depending on what approaches we take moving forward.

For this reason, the general proposal should be that we have the following order: [...]
Does that work? Any thoughts?

I think it works, but because it is a larger reordering, it would need a separate task (especially because it would be a bit awkward to feature-flag it). So, we'd have a separate task just for reordering the *existing* fields, contribution tracking excluded, and that ticket would be worked on and released immediately. This task would depend on that one, and we would just insert the tracking toggle in the right place.

Language/final copy:

Thanks for checking in on this! Yes, it may be better to avoid words like "tracking," and instead say something like "contribution statistics" or "contribution impact." @JFernandez-WMF will look into this and provide some language suggestions in the next day or two.

That makes sense. If we want to use a different name to be used internally, this would be a good time to decide on it.

The list will need to be kept up-to-date manually if there are any changes: You mean that the order of the fields will be need to be maintained manually? If that is the case, is that okay? Any concerns?

Whooops, no, I meant the list of countries where this feature can't be used. So, if for example the US became higher risk and Russia became lower risk, this change wouldn't be reflected unless we manually update our list of allowed countries. Events in the US would still be able to enable tracking, and events in Russia would not, until one of us is made aware of the change and updates the configuration.

(Apologies for not including this in my previous comment. I think I was writing the comment while checking the implementation and forgot to add context.)

Hey @Daimona, responses below:

For this reason, the general proposal should be that we have the following order: [...]
Does that work? Any thoughts?

I think it works, but because it is a larger reordering, it would need a separate task (especially because it would be a bit awkward to feature-flag it). So, we'd have a separate task just for reordering the *existing* fields, contribution tracking excluded, and that ticket would be worked on and released immediately. This task would depend on that one, and we would just insert the tracking toggle in the right place.

Okay, done! See T403758. Note that the final order that I added to the ticket is slightly different than the comment that I wrote above, since I took a second pass at it and decided to just do a smaller set of changes, with the goal of ensuring that participation options is before (not after!) the dashboard link. I decided to keep event types where it is, since I think it is a more broad question about the event overall, so it made sense to thematically keep it higher up in the list of questions. While we also do only allow contribution events to use collaborative contribution tracking, I don't think event type needs to be asked in the same general areas as the toggle for collaborative contributions -- it just needs to come before it. So, we should be good.

Language/final copy:

Thanks for checking in on this! Yes, it may be better to avoid words like "tracking," and instead say something like "contribution statistics" or "contribution impact." @JFernandez-WMF will look into this and provide some language suggestions in the next day or two.

That makes sense. If we want to use a different name to be used internally, this would be a good time to decide on it.

Yup! Agreed. More info coming soon :)

The list will need to be kept up-to-date manually if there are any changes: You mean that the order of the fields will be need to be maintained manually? If that is the case, is that okay? Any concerns?

Whooops, no, I meant the list of countries where this feature can't be used. So, if for example the US became higher risk and Russia became lower risk, this change wouldn't be reflected unless we manually update our list of allowed countries. Events in the US would still be able to enable tracking, and events in Russia would not, until one of us is made aware of the change and updates the configuration.

(Apologies for not including this in my previous comment. I think I was writing the comment while checking the implementation and forgot to add context.)

Aaaaah, that makes sense! Thank you for clarifying!

@ifried Thank you. So, in the new ordering, the toggle would be placed between participation options and P&E Dashboard, right? That would work for me, it's just the AC that need updating. Speaking of which:

  • And if the organizer tries to enable contribution tracking for an invalid event,
    • They should see the following error message: "This event does not qualify for contribution tracking."

What is this for? It wasn't there before. Has it been superseded by the next AC?

Aside from this, the change is mostly ready to go but waiting for the updated text.

@ifried What do we think of 'Show contribution impact' for the toggle label? Is it too vague?

And here's an option for an updated helper text which explains a bit more:

"Enabling contribution impact will help you understand the event’s outcomes by showing both an overall summary and the individual contributions behind it."

ifried updated the task description. (Show Details)
ifried updated the task description. (Show Details)

@ifried Thank you. So, in the new ordering, the toggle would be placed between participation options and P&E Dashboard, right? That would work for me, it's just the AC that need updating. Speaking of which:

The AC has been updated. Thanks for pointing this out!

  • And if the organizer tries to enable contribution tracking for an invalid event,
    • They should see the following error message: "This event does not qualify for contribution tracking."

What is this for? It wasn't there before. Has it been superseded by the next AC?

So the idea was that one error message is if the user inputs that is not a contribution event (for example, a meetup), so it does not qualify for contribution tracking. The other message is supposed to be for an invalid country. Does that make sense?

Aside from this, the change is mostly ready to go but waiting for the updated text.

Yup! I created an second draft of text, based on Julieta's suggestion that she shared below & I added to the AC. I want to see what she thinks - we're almost there :)

@ifried What do we think of 'Show contribution impact' for the toggle label? Is it too vague?

And here's an option for an updated helper text which explains a bit more:

"Enabling contribution impact will help you understand the event’s outcomes by showing both an overall summary and the individual contributions behind it."

Hey @JFernandez-WMF!

Thanks for this suggestion. I think it is definitely better. I have updated it a bit (see the AC), since I felt like it was almost there but could be a bit more clear. Here is the new version that I wrote - let me know what you think:

"Show contribution statistics," with the following helper text: "Enable contribution statistics, so that you can share and understand the impact of the event. A summary and full list of edits is provided."

Thank you, that sounds good to me! I'll also update the error messages on the AC to reflect statistics instead of tracking.

So the idea was that one error message is if the user inputs that is not a contribution event (for example, a meetup), so it does not qualify for contribution tracking. The other message is supposed to be for an invalid country. Does that make sense?

OH! It does make sense, I just didn't understand, from the previous AC, that we would also have this restriction based on the event type.


Seeing the latest message above, is this officially ready now?

So the idea was that one error message is if the user inputs that is not a contribution event (for example, a meetup), so it does not qualify for contribution tracking. The other message is supposed to be for an invalid country. Does that make sense?

OH! It does make sense, I just didn't understand, from the previous AC, that we would also have this restriction based on the event type.

Although I guess in that case, wouldn't it make sense to say what the exact problem is? As a user, I'd be frustrated if all i was told is that the event "does not qualify". Maybe something like "Contribution statistics can only be enabled for events with the following types: <list>" ?

Change #1183115 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Add contribution tracking flag to event entity and storage layers

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

Change #1186955 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Change position of contribution tracking in event entity

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

Change #1186955 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Change position of contribution tracking in event entity

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

Change #1183123 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] EventFactory: implement contribution tracking validation

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

Change #1183121 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Let organizers enable contributions tracking

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

Change #1183144 merged by jenkins-bot:

[operations/mediawiki-config@master] Configure high-risk countries for CampaignEvents

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

Mentioned in SAL (#wikimedia-operations) [2025-09-11T20:26:32Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1187521|Deploy Parsoid Read Views to 23 Wikipedias (T404390)]], [[gerrit:1183144|Configure high-risk countries for CampaignEvents (T402353)]]

Mentioned in SAL (#wikimedia-operations) [2025-09-11T20:32:51Z] <cscott@deploy1003> daimona, cscott: Backport for [[gerrit:1187521|Deploy Parsoid Read Views to 23 Wikipedias (T404390)]], [[gerrit:1183144|Configure high-risk countries for CampaignEvents (T402353)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-09-11T20:40:35Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1187521|Deploy Parsoid Read Views to 23 Wikipedias (T404390)]], [[gerrit:1183144|Configure high-risk countries for CampaignEvents (T402353)]] (duration: 14m 02s)

This is now testable locally. Note, you need to enable the temporary $wgCampaignEventsEnableContributionTracking feature flag, and also set a list of forbidden countries via $wgCampaignEventsContributionTrackingDisallowedCountries.

Acceptance Criteria:
  • ✅ Given that an organizer has created an event that focuses on contributions (i.e., Editing event, Media upload event, Backlog drive or Contest selected as at least one option in "Event type"),
    • And if hybrid or in person, it is not in a country that is considered "no publish" or "high risk" (see list)

QA note - The event can be enabled with showing contribution statistics alsoif it is an Online event, not only Hybrid or In person and also if the country is considered high risk. Does this need changed in the AC?

enabled when event type Online
Screen Recording 2025-09-15 at 5.14.07 PM.gif (1×1 px, 1 MB)

QA note - Of the three ways I tried to include a country in the disallowed list using country codes, none of the inclusions blocked the event from being created:
$CampaignEventsContributionTrackingDisallowedCountries = ['AF', 'Afghanistan', 'AFG'];

gif showing event enabled when country is labeled high risk
Screen Recording 2025-09-15 at 5.18.01 PM.gif (1×1 px, 1 MB)
    • ✅ The organizer should see the option to toggle on "Show contribution statistics," with the following helper text: "Enable contribution statistics, so that you can share and understand the impact of the event. A summary and full list of edits is provided."
      Screenshot 2025-09-15 at 5.31.48 PM.png (150×1 px, 41 KB)
      • ✅ And this toggle should be placed between Participation Options and P&E Dashboard link
        Screenshot 2025-09-15 at 5.11.46 PM.png (758×1 px, 145 KB)
      • ✅ And it should be toggled on by default
        Screenshot 2025-09-15 at 5.11.55 PM.png (160×1 px, 42 KB)
  • And if the organizer tries to enable contribution tracking for an invalid event type,
    • ✅ They should see the following error message: "Contribution statistics can only be enabled for events with the following types: <list>"
      Screenshot 2025-09-15 at 5.05.08 PM.png (224×1 px, 45 KB)
  • And if the organizer tried to enable contribution tracking for an invalid country,
    • ❌ They should see the following error message: "Contribution statistics cannot be enabled for the selected country." QA - see note above on disallowed country
  • And if hybrid or in person, it is not in a country that is considered "no publish" or "high risk" (see list)

QA note - The event can be enabled with showing contribution statistics alsoif it is an Online event, not only Hybrid or In person and also if the country is considered high risk. Does this need changed in the AC?

Both AC and behaviour seem correct to me: statistics can be enabled if "the event focuses on contribution AND, IF in-person, is not in a high-risk country.

QA note - Of the three ways I tried to include a country in the disallowed list using country codes, none of the inclusions blocked the event from being created:
$CampaignEventsContributionTrackingDisallowedCountries = ['AF', 'Afghanistan', 'AFG'];

The correct format is to specify them as array keys, as per documentation:

This maps CLDR country codes to English country names, but only the former are used; the names are included for convenience, and are assumed to be correct.

See also example in WMF config.

  • And if hybrid or in person, it is not in a country that is considered "no publish" or "high risk" (see list)

QA note - The event can be enabled with showing contribution statistics alsoif it is an Online event, not only Hybrid or In person and also if the country is considered high risk. Does this need changed in the AC?

Both AC and behaviour seem correct to me: statistics can be enabled if "the event focuses on contribution AND, IF in-person, is not in a high-risk country.

Ahh, okay I see, I misunderstood.


QA note - Of the three ways I tried to include a country in the disallowed list using country codes, none of the inclusions blocked the event from being created:
$CampaignEventsContributionTrackingDisallowedCountries = ['AF', 'Afghanistan', 'AFG'];

The correct format is to specify them as array keys, as per documentation:

This maps CLDR country codes to English country names, but only the former are used; the names are included for convenience, and are assumed to be correct.

See also example in WMF config.

Okay I am trying again and still am getting the same result:

Screen Recording 2025-09-17 at 12.17.19 AM.gif (1×1 px, 1 MB)

using the following:

$wgCampaignEventsEnableContributionTracking = true;
$wgCampaignEventsContributionTrackingDisallowedCountries = [
		'BH' => 'Bahrain',
		'BY' => 'Belarus',
	];

Am I still missing something here?

Change #1189140 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Fix disallowed country codes format for EventFactory

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

using the following: [...]
Am I still missing something here?

Ah whoops no, that's my fault. I changed the format of the config setting but forgot to update its usage in one place. Made the one-liner fix above.

Change #1189140 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Fix disallowed country codes format for EventFactory

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

using the following: [...]
Am I still missing something here?

Ah whoops no, that's my fault. I changed the format of the config setting but forgot to update its usage in one place. Made the one-liner fix above.

Perfect, working as expected now:

Screenshot 2025-09-17 at 12.57.46 PM.png (396×1 px, 62 KB)

@Daimona I believe the API docs still need to be updated to have the a flag to toggle collaborative contributions for enable, edit, get.

And the API endpoints (enable/edit/get registration) should have equivalent functionality and be documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents/Api

@Daimona I believe the API docs still need to be updated to have the a flag to toggle collaborative contributions for enable, edit, get.

And the API endpoints (enable/edit/get registration) should have equivalent functionality and be documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents/Api

Ah yes, done.

@Daimona I believe the API docs still need to be updated to have the a flag to toggle collaborative contributions for enable, edit, get.

And the API endpoints (enable/edit/get registration) should have equivalent functionality and be documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents/Api

Ah yes, done.

✅ And the API endpoints (enable/edit/get registration) should have equivalent functionality and be documented in https://www.mediawiki.org/wiki/Extension:CampaignEvents/Api

enable "tracks_contributions" : falseGET
Screenshot 2025-09-22 at 3.38.17 PM.png (1×1 px, 202 KB)
Screenshot 2025-09-22 at 3.40.37 PM.png (1×1 px, 278 KB)
edit "tracks_contributions" : trueGET
Screenshot 2025-09-22 at 3.43.02 PM.png (1×1 px, 220 KB)
Screenshot 2025-09-22 at 3.51.15 PM.png (1×1 px, 264 KB)

With this, all AC is met and I am sending to design sign off. @JFernandez-WMF there are some screen shots of the functionality at T402353#11183133