Index: trunk/extensions/CustomUserSignup/CustomUserSignup.php |
— | — | @@ -39,6 +39,7 @@ |
40 | 40 | |
41 | 41 | // NOTE: This hook includes JS for the account creation project |
42 | 42 | $wgHooks['BeforePageDisplay'][] = 'CustomUserSignupHooks::beforePageDisplay'; |
| 43 | +$wgHooks['AddNewAccount'][] = 'CustomUserSignupHooks::addNewAccount'; |
43 | 44 | |
44 | 45 | |
45 | 46 | // For Account Creation Project |
Index: trunk/extensions/CustomUserSignup/CustomUserSignup.hooks.php |
— | — | @@ -100,8 +100,22 @@ |
101 | 101 | return true; |
102 | 102 | } |
103 | 103 | |
104 | | - public static function beforePageDisplay( $out, $skin ) { |
105 | | - $out->addModules( 'ext.UserBuckets' ); |
106 | | - return true; |
| 104 | + public static function beforePageDisplay( $out, $skin ) { |
| 105 | + $out->addModules( 'ext.UserBuckets' ); |
| 106 | + return true; |
| 107 | + } |
| 108 | + |
| 109 | + public static function addNewAccount( $user, $byEmail ){ |
| 110 | + global $wgRequest; |
| 111 | + $buckets = ClickTrackingHooks::unpackBucketInfo(); |
| 112 | + if(isset($buckets['AccountCreation']) && $buckets['AccountCreation'][0] != "none"){ |
| 113 | + |
| 114 | + // *NOT HTTPONLY* In fact, that's the point of this cookie |
| 115 | + |
| 116 | + setcookie( 'acctcreation' , $buckets['AccountCreation'][0] , |
| 117 | + time() + 60 * 60 * 24 * 365 ); |
107 | 118 | } |
| 119 | + return true; |
| 120 | + } |
| 121 | + |
108 | 122 | } |
\ No newline at end of file |
Index: trunk/extensions/CustomUserSignup/modules/AccountCreationUserBucket.js |
— | — | @@ -21,37 +21,46 @@ |
22 | 22 | // particularly if there are orders of magnitude differences in the |
23 | 23 | // bucket sizes |
24 | 24 | // "none" is reserved for control |
25 | | - "rates": {"NiceMsg1": 1, "NiceMsg2": 1 }, |
| 25 | + "rates": {"ACP1": 25, "ACP2": 25, "ACP3": 25, "none": 25}, |
26 | 26 | |
27 | 27 | // individual changes, function names corresponding |
28 | 28 | // to what is in "rates" object |
29 | 29 | // (note: "none" function not needed or used) |
30 | 30 | |
31 | | - "NiceMsg1": function(){ |
| 31 | + "ACP1": function(){ |
32 | 32 | //change to NiceMsg1 campaign |
33 | | - $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg1" ); |
| 33 | + $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP1" ); |
34 | 34 | }, |
35 | | - "NiceMsg2": function(){ |
| 35 | + "ACP2": function(){ |
36 | 36 | //change to NiceMsg2 campaign |
37 | | - $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg2" ); |
| 37 | + $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP2" ); |
38 | 38 | }, |
| 39 | + |
| 40 | + "ACP3": function(){ |
| 41 | + //change to NiceMsg2 campaign |
| 42 | + $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP3" ); |
| 43 | + }, |
39 | 44 | |
40 | 45 | // "allActive" is reserved. |
41 | 46 | // If this function exists, it will be apply to every user not in the "none" bucket |
42 | 47 | "allActive": function(){ |
| 48 | + if($j.cookie('acctcreation') ){ |
| 49 | + |
| 50 | + //track login attempt |
| 51 | + $j("#wpLoginAttempt").click(function(){ $j.trackAction('login-attempt'); }); |
| 52 | + |
| 53 | + //track account creation |
| 54 | + $j("#wpCreateaccount").click(function(){ $j.trackAction('account-created'); }); |
| 55 | + $j("#userloginlink").click(function(){ $j.trackAction('login-link'); }); |
| 56 | + |
| 57 | + //add click tracking to preview |
| 58 | + $j("#wpPreview").click(function(){ $j.trackAction('preview'); }); |
| 59 | + |
| 60 | + //add click tracking to save |
| 61 | + $j("#wpSave").click(function(){ $j.trackAction('save'); }); |
| 62 | + } |
43 | 63 | |
44 | | - //add click tracking to save |
45 | | - $j("#wpSave").click(function(){ $j.trackAction('save'); }); |
46 | 64 | |
47 | | - //track login attempt |
48 | | - $j("#wpLoginAttempt").click(function(){ $j.trackAction('login-attempt'); }); |
49 | | - |
50 | | - //track account creation |
51 | | - $j("#wpCreateaccount").click(function(){ $j.trackAction('account-created'); }); |
52 | | - |
53 | | - //add click tracking to preview |
54 | | - $j("#wpPreview").click(function(){ $j.trackAction('preview'); }); |
55 | | - |
56 | 65 | } |
57 | 66 | |
58 | 67 | }; |
\ No newline at end of file |