Extension:E3 Experiments/Architecture

E3Experiment for post-edit feedback
This puts up a message on successful edit.

Because edit redirects to a normal page URL, this registers a hook for ArticleUpdateBeforeRedirect (in Experiments.hooks.php) that appends ?pe=1 to the URL.

Most of the rest of the code is JavaScript running in the browser. The extension uses the MW resource loader to load everything in lib/*.js onBeforePageDisplay, and supplies the user's edit count and registration date as JS mw.config variables wgEditCount and wgRegistration.

Eligibility

 * Tracking is expensive, the goal is to run it as little as possible

JavaScript code on client computes experiment start and end times, eligibility duration, etc.
 * test: use latest dashboard (see ../Testing, it reports times. ? See if bucketing occurs inside/outside the window.

Also if pageIsAppropriate, etc.
 * Perhaps server-side onBeforePageDisplay hook code could skip loading the JS code if !pageIsAppropriate

if the user is in the experiment, it calls mw.experiments.murmur3 to turn the wgUserName into a random-ish number, assigns to control/experimental_1/experimental_2 bucket from this, then calls ClickTracking jQuery code to remember this in the userbuckets cookie. It also calls $.trackActionWithOptions (more ClickTracking code) to track this as PEF1BUCKETASSIGN may turn off this event

Extension:ClickTracking
mw:Extension:ClickTracking is used by various extensions besides E3, like moodbar, article feedback tracking.


 * Provides user bucketing JS functions on jQuery $ that add information to userbuckets cookie (in ext.UserBuckets.js). UserBuckets can also set up a campaign if you provide it enough info in mw.activeCampaigns, but unlike say Account Creation, E3 Experiments doesn't do this.
 * Provides action tracking JS functions on jQuery $ such as $.trackAction('SOME INFO') (in jquery.clickTracking.js). The action tracking functions
 * check for a clicktrackingDebug cookie and set it if ?clicktrackingDebug is in the query string
 * if it doesn't already exist, set a clicktracking-session cookie
 * post using XMLHttpRequest a clicktracking action to api.php (This is hella expensive, it can't be cached!) unless clicktrackingDebug

ClickTracking does lots of other things like rewrite left-side navbar to track clicks, provides a function to track a URL (by requesting it through api.php which then redirects to the requested URL &mdash; expensive), hook into EditPage::showEditForm:fields form fields to add clicktrackingsession and event hidden form fields, etc. Kill this code if not used any more

API calls
ClickTracking's API module always (?) logs additional information, such as whether the user isLoggedIn, the user's edit counts over three time periods, etc.


 * if ($wgClickTrackingDatabase) it writes the data to the click_tracking database table, and writes the values of all buckets in the userbuckets cookie to the click_tracking_user_properties database table.
 * if ($wgClickTrackingLog) it calls wfErrorLog to log most of the information, but not buckets.