Page MenuHomePhabricator

Change donate link target of de.m.wikipedia.org
Closed, ResolvedPublic3 Estimated Story Points

Description

Recently, a donate link was added to the main navigation of Minerva. It points to the donation application of the Wikimedia Foundation and passes some utm_ parameters to it. Usually, the application forwards users in Germany to our page. It does not append any Matomo tags, so we can't identify where users are coming from.

Acceptance Criteria

  • A test version of the script is added to the dev's script page.
  • The donate link on de.m.wikipedia.org is replaced by a direct link to our donation page including Matomo tags.
  • The Matomo tags are defined as piwik_campaign=de.m.wikipedia.org and piwik_kwd=sidebar.

Notes
There is a function replacing the donate link of the desktop skins in desktop skins. The file is not loaded by the mobile skin extension, though (see Manual:Interface/JavaScript - MediaWiki).

We don't have edit rights for the page and probably need to propose a change on the talk page. Once the snippet is done, somebody else politely asks the dewiki admins to put this into MediaWiki:Mobile.js.

Event Timeline

Restricted Application added subscribers: Masumrezarock100, Aklapper. · View Herald Transcript
kai.nissen set the point value for this task to 3.

You may need to use MediaWiki:Mobile.js, (instead of MediaWiki:Minerva.js) otherwise the link will not be changed for mobile users who are not using Minerva skin, for instance.

Just copy the same snippet from dewiki's MediaWiki:Common.js but change the selector to target 'p-donation'. It was actually intended to be the same as with the desktop, but I now see it's being overriden by the other id. I believe this would work.

$( function() {
 if ( typeof( Geo ) === "object" && Geo.country === 'DE' && mw.config.get( 'wgUserLanguage' ) === 'de' ) {
  var baseUrl = 'https://spenden.wikimedia.de/';
  var queryString = $.param({
      'piwik_campaign': 'de.wikipedia.org',
      'piwik_kwd': 'sidebar',
      'language': mw.config.get( 'wgUserLanguage' ),
      'country': Geo.country
  });
  $("#p-donation a").attr("href", baseUrl + '?' + queryString);
 }
});

Maybe you may need to change 'piwik_kwd': 'sidebar', to say 'mobile-sidebar' also.

@kai.nissen I added the code snippet @Ammarpad supplied as a user script on my account (https://de.m.wikipedia.org/wiki/Benutzer:AbbanDunne/common.js) and can confirm it works as expected.

Thank you, @Ammarpad, it's working.