Extension:E3 Experiments/Testing
Contents |
Check if the extension is live [edit]
To see if it's running,
- visit Special:Version on the appropriate wiki
- in a console like Firebug, Firefox Tools > Web Developer > Web Console or Chrome(ium)'s ? console, enter variables like:
- mw.activeCampaigns - a JSON structure of campaign info (maintained by ClickTracking extension. may includes Account Creation bucketing)
- $.cookie('userbuckets')
- to force a Post-Edit Feedback display, enter mw.experiments.showFeedback('Thanks for playing')
- (different from the generic JS notification mw.util.jsMessage( 'This is something a message for the user' );
)
-
- you can print some MediaWiki info pushed to JS variables using mw.config.get() mw.config.get(wgUserRegistration) mw:Manual:Interface/JavaScript lists variables you can print, extensions add more.
- The extension relies upon the ClickTracking extension; to verify that is working in a console you can call
- $.trackAction('my test string') to trigger a tracking event (generally an XMLHttpRequest posted to api.php)
- $.getTrackedActions() - returns a JSON structure of events that have fired, including the manual trigger above
Test environment [edit]
You can set a debug cookie: $.cookie( "clicktrackingDebug", 1, { path: "/", expires: 365 }); to enable debug message output in a JavaScript console. Note that this also disables ClickTracking from logging events.
There are some general query string parameters that alter the behavior of MediaWiki.
| Variable / value | Magic |
|---|---|
debug=1 |
Makes MediaWiki load JavaScript and CSS resources separately (instead of minified chunks), giving useful source lines for debugging errors. May avoid browser caching issues. Without it bad JS code may silently fail without any warnings in the browser's console. |
clicktrackingDebug=1 |
Sets a clicktrackingDebug cookie, described above |
For post-edit feedback [edit]
This has additional "magic" query string parameters that force certain internal checks to evaluate as true:
| Variable / value | Magic |
|---|---|
pef_eligible=1 |
Current user is deemed eligible |
pef_active=1 |
Experiment is active (for some people) |
pef_on=1 |
Experiment is turned on for current user |
e3ec=number |
Force edit count |
e3time=number |
Force current time |
e3dep=number |
Force deployment time |
e3reg=number |
Force registration time |
Times are represented as number of milliseconds between midnight, January 1, 1970 and the current time, UTC. You can use Epoch Converter to convert a human-readable date to seconds since epoch, then add three zeros to get a value in milliseconds. In a browser's JavaScript console, Date.now() will give the value in milliseconds for the current time, and you can get values for other dates using new Date( 'Fri Sep 21 2012' ).getTime(), new Date( '2012-09-21' ).getTime(), etc.
For account creation UX [edit]
It has its own "magic" query string parameters, some similar to PEF, that force certain internal checks to evaluate as true (in flux):
| Variable / value | Magic |
|---|---|
acux_bucket=acux_1 or control |
Force current user into modified form or existing form. |
acux_debug=1 |
Show debug messages in console (like clicktrackingDebug, without affecting logging) |
acux_eligible=1 |
Current user is deemed eligible |
acux_active=1 |
Experiment is active (for some people), regardless of date |
acux_on=1 |
Experiment is turned on for current user |
e3time=number |
Force current time |
e3dep=number |
Force deployment time |
Tips [edit]
Many experiments are targeted to newly registered Wikipedia users. In a browser console, the MediaWiki variable for registration date is mw.config.get( 'wgRegistration' ) in UTC (London time, not local time). You can use the dashboard's Campaigns addition to put yourself in a user bucket.
When you see a hard-to-read collection of curly braces like
[16:20:34.872] ({AccountCreation:{name:"AccountCreation", version:1, preferences:{setBuckets:false}, rates:{ACP1:25, ACP2:25, ACP3:25, none:25}, ACP1:(function () {$j("#pt-anonlogin a").each(function () {$j(this).attr("href", $j(this).attr("href") + "&campaign=ACP1");})
try pasting just the part in curly braces through http://jsonlint.com . Even if the validator fails, it will format it nicely for you.
When you see URL-encoded text like
%7B%22AccountCreation%22%3A%5B%22ACP3%22%2C1%5D%7D
try pasting it into http://meyerweb.com/eric/tools/dencoder/ and clicking [Decode]. Or in a console,
unescape("paste string here")
will approximate this.
Cookies [edit]
- See also Event logging#Anonymously identifying users for the use of some of these.
In the net panel of a debugger, inspect a request, you will see lots of cookies
Once someone is bucketed, he or she gets an updated userbuckets cookie. There are many other cookies set on MediaWiki wikis, here are some (from August 2012):
| cookie | comment | sample |
|---|---|---|
| userbuckets | this is the key. Each active test (such as E3's "PEF") may add the user to various buckets for various tests, and ClickTracking extension's $.setBucket() adds records in this cookie. | %7B%22AccountCreation%22%3A%5B%22ACP3%22%2C1%5D%7D ( AccountCreation: ACP3,1 in JSON, set by discontinued Extension:CustomUserSignup) |
| clicktracking-session | from ClickTracking extension, set when some tracking takes place | QrtoK2uco4Maine0MxiFY072LQ1CEECGs |
| clicktrackingDebug | from ClickTracking extension, set to true when a URL has ?clicktrackingDebug in its query string | 1 |
| mediaWiki.user.bucket%3Aext.articleFeedback-options | E2 cookie for AFT | 8%3Ashow |
| mediaWiki.user.bucket%3Aext.articleFeedback-tracking | E2 cookie for AFT | 10%3Atrack |
| mediaWiki.user.bucket%3Amoodbar%403-trigger | 3%3Aediting | |
| mediaWiki.user.id | token generated by JavaScript mw.user.id() if the user is anonymous, used by AFT/AFTv4 |
yvQv8SJY4J79LzRHtVjQ5lXvq2Wk88DW |
| wikiname_session | set if you are a logged-in user | d6a041b7145c4ffd11efb964637c657c |
Test accounts (sockpuppets) [edit]
We use test accounts by the bucket load in both test environments like Labs, as well as in production.
If you make a test account on English Wikipedia: it is important that you do the following things:
- If the accounts makes edits, especially to articles, tag it on the user page with
{{Alternate account|Your staff username}}. This also puts it in a category used to filter out test accounts. - Whether you make edits or not, all test accounts that get bucketed should be noted and emailed to Steven, so he can include them in a report to Philippe. This reporting is good courtesy to the community, so that we know what legitimate sockpuppets are out there, in case illegitimate WMF sockpuppets become an issue that merits investigating.
Interactions [edit]
Special:Preferences > Appearance > "Exclude me from feature experiments" checkbox...
Events/tracking don't seem to fire on pages in the Special namespace.