Extension:ContributionTracking

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
ContributionTracking
Release status: stable
Implementation Special page
Description Statistics for the Wikimedia fundraiser
Author(s) David Strauss, Katie Horn (Khorn (WMF)talk)
Latest version SVN
Database changes Yes
License No license specified
Download
Translate the ContributionTracking extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

ContributionTracking provides some statistics on the Wikimedia Foundation fundraiser.

It includes two unlisted special pages, which are not used by humans but only by other internal functions (with Extension:DonationInterface): Special:ContributionTracking and Special:ContributionTrackingTester (sysop only).

It supports two payment gateways, PayPal and Moneybookers (largely deprecated).

Setup[edit]

Download the extension, put

require_once( "$IP/extensions/ContributionTracking/ContributionTracking.php" );

into your LocalSettings.php file, then run

alter table <prefix>contribution_tracking modify anonymous tinyint(1) unsigned default null, modify optout tinyint(1) unsigned default null;

on your database. Be sure to replace <prefix> with your wiki's database table prefix.

API[edit]

The purpose of the ContributionTracking API is to remove the interstitial page between the user-facing donate button, and the remote gateway. Instead of posting the whole transaction to a page, the form data is sent to the API via ajax. The API records the tracking data, and returns a json object that can be used to build a hidden form, and immediately repost that hidden form to the remote gateway.

For a working end-to-end demonstration of this technique, see Special:ContributionTrackingTester. The available form fields are pulled dynamically from the API's AllowedParams, so it will always show all available field options. (Note: Any additional fields posted to the API will be summarily ignored)

As on the ContributionTrackingTester page, all that is necessary to use the API to remove the interstitial page between a gateway form and the remote gateway, are the two following changes: To add the jquery.contributionTracking module which handles the ajax and hidden repost form, add the following line to the php form's execute method:

$wgOut->addModules( 'jquery.contributionTracking' );

Then, add the class "ajax_me" to the relevant form's submit button. Once that is done, the button's parent form will be under the control of the included jquery.contributionTracking module.

See also[edit]