Extension:ContributionTracking

ContributionTracking provides contribution tracking for the Wikimedia fundraiser.

It includes two unlisted special pages: Special:ContributionTracking and Special:ContributionTrackingTester (sysop only).

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

Setup
Download the extension, put

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

into your LocalSettings.php file, then run

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

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

API
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.