Page MenuHomePhabricator

Introduce additional replaceable parameters to fundraising configuration json.
Open, MediumPublic0 Estimated Story Points

Description

Currently the fundraising json structure supports a client-side parameter called $platform;, which gets replaced by the respective client with the corresponding platform name (Android / iOS). This is used in the action url string for filling in the platform name for analytics purposes.

We propose adding the following additional parameters:

  • $formattedId; -- which would take the place of the entire value of the current wmf_source url parameter. The notion of "formatted ID" is already something that is firmly established within our code. Specifically, the formatted ID is a string that is made up of these components: [language][country]_[campaignID]_[platform]. So then, the formatted ID effectively becomes something of this form: enUS_US_2025_Android. But if you look closely at the url parameters specified in the current campaign configuration, this is exactly what the wmf_source parameter is trying to be. Except currently, the wmf_source parameter must be manually composed by the creators of the campaign structure, which can lead to errors and inconsistencies such as observed in T415692. If we introduce a $formattedId; parameter, and simply plug it into the url as wmf_source=$formattedId;, the authors of the campaign configuration will no longer need to worry about composing it properly, and will eliminate this class of bugs.
  • $country; -- replaced by the current GeoIP country of the client.
  • $language; -- replaced by the current language selected by the client.
  • $appVersion; -- replaced by the current app version string.
  • $appInstallId; -- replaced by the current app install ID.

We are also agreeing that this would necessitate bumping the structure version number to 3.

iOS-specific notes
  • $formattedId; -The iOS codebase uses the naming metricsID for this particular type of ID. iOS should also rename codebase references from "metricsID" to "formattedID" to match Android.
  • $country; -- replace with Locale.current.region?.identifier
  • $language; -- replace by the current article wiki language code OR language variant code if it applies. We construct the article's wiki project before displaying campaigns here. The wiki project enum has .languageCode and .languageVariantCode helper properties.
Testing config

A config for testing has already been bumped to version 3 and updated with the correct url parameters. Raw view is located at https://test.wikipedia.org/wiki/MediaWiki:AppsCampaignConfig.json?action=raw.

Event Timeline

A couple of other parameters that might be "nice to have" are:

  • $country; - to be replaced wherever the user's country code should appear.
  • $language; - to be replaced wherever the user's language should appear.

...to plug into the country and uselang url parameters respectively, which will further simplify the composition of those URLs.

HNordeenWMF triaged this task as Medium priority.Feb 3 2026, 5:30 PM
Dbrant renamed this task from Introduce `$formattedId` parameter to fundraising configuration json. to Introduce additional replaceable parameters to fundraising configuration json..Mon, Jul 20, 8:18 PM
Dbrant updated the task description. (Show Details)
Dbrant added a subscriber: Tsevener.
Tsevener removed the point value 1 for this task.Mon, Jul 20, 11:40 PM
Seddon changed the point value for this task from 5 to 0.Wed, Aug 5, 4:34 PM

Verifying I do see the successful BR Banner donation linked above in FR Tech/Metabase data.

ColumnData
Receive datetime: DayAug 4, 2026
Country codeBR
Gift typeone-time gift
Donor typeFY2627 repeat
UTM campaigniOS
App channelBanner
BannerenBR_BR_2026_08_Control_iOS
Banner target language country2026
Sum of Total amount USD ($)2.95
Count1
UTM keyAEBB3236-6CC3-441A-BB1D-5FF85ED12C14
Contribution ID147356397