Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | * @return true if the event was stored in the DB |
165 | 165 | */ |
166 | 166 | public static function trackEvent( $session_id, $is_logged_in, $namespace, $event_id, $contribs = 0, |
167 | | - $contribs_in_timespan1 = 0, $contribs_in_timespan2 = 0, $contribs_in_timespan3 = 0 ) { |
| 167 | + $contribs_in_timespan1 = 0, $contribs_in_timespan2 = 0, $contribs_in_timespan3 = 0, $additional= null ) { |
168 | 168 | $dbw = wfGetDB( DB_MASTER ); |
169 | 169 | |
170 | 170 | $dbw->begin(); |
— | — | @@ -178,7 +178,8 @@ |
179 | 179 | 'user_contribs_span2' => ( $is_logged_in ? (int) $contribs_in_timespan2 : null ), |
180 | 180 | 'user_contribs_span3' => ( $is_logged_in ? (int) $contribs_in_timespan3 : null ), |
181 | 181 | 'namespace' => (int) $namespace, |
182 | | - 'event_id' => (int) $event_id |
| 182 | + 'event_id' => (int) $event_id, |
| 183 | + 'additional_info' => ( isset($additional) ? (string) $additional : null ) |
183 | 184 | ); |
184 | 185 | |
185 | 186 | $db_status = $dbw->insert( 'click_tracking', $data, __METHOD__ ); |
Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.js |
— | — | @@ -6,6 +6,14 @@ |
7 | 7 | wgScriptPath + '/api.php', { 'action': 'clicktracking', 'eventid': id, 'token': wgTrackingToken } |
8 | 8 | ); |
9 | 9 | }; |
| 10 | + |
| 11 | + $.trackActionWithInfo = function( id, info ) { |
| 12 | + $j.post( |
| 13 | + wgScriptPath + '/api.php', { 'action': 'clicktracking', 'eventid': id, 'token': wgTrackingToken, 'additional': info } |
| 14 | + ); |
| 15 | + }; |
| 16 | + |
| 17 | + |
10 | 18 | // Add click tracking hooks to the sidebar |
11 | 19 | $j(document).ready( function() { |
12 | 20 | $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' ).each( function() { |
Index: trunk/extensions/UsabilityInitiative/ClickTracking/ApiClickTracking.php |
— | — | @@ -19,7 +19,15 @@ |
20 | 20 | $this->validateParams( $params ); |
21 | 21 | $eventid_to_lookup = $params['eventid']; |
22 | 22 | $session_id = $params['token']; |
23 | | - |
| 23 | + |
| 24 | + $additional = null; |
| 25 | + |
| 26 | + if( isset($params['additional']) && strlen($params['additional']) > 0){ |
| 27 | + $additional = $params['additional']; |
| 28 | + |
| 29 | + } |
| 30 | + |
| 31 | + |
24 | 32 | // Event ID lookup table |
25 | 33 | // FIXME: API should already have urldecode()d |
26 | 34 | $event_id = ClickTrackingHooks::getEventIDFromName( urldecode( $eventid_to_lookup ) ); |
— | — | @@ -43,7 +51,8 @@ |
44 | 52 | ( $is_logged_in ? $wgUser->getEditCount() : 0 ), // total edit count or 0 if anonymous |
45 | 53 | $granularity1, // contributions made in granularity 1 time frame |
46 | 54 | $granularity2, // contributions made in granularity 2 time frame |
47 | | - $granularity3 // contributions made in granularity 3 time frame |
| 55 | + $granularity3, // contributions made in granularity 3 time frame |
| 56 | + $additional |
48 | 57 | ); |
49 | 58 | |
50 | 59 | // For links that go off the page, redirect the user |
— | — | @@ -83,7 +92,8 @@ |
84 | 93 | return array( |
85 | 94 | 'eventid' => 'string of eventID', |
86 | 95 | 'token' => 'unique edit ID for this edit session', |
87 | | - 'redirectto' => 'URL to redirect to (only used for links that go off the page)' |
| 96 | + 'redirectto' => 'URL to redirect to (only used for links that go off the page)', |
| 97 | + 'additional' => 'additional info for the event, like state information' |
88 | 98 | ); |
89 | 99 | } |
90 | 100 | |
— | — | @@ -104,7 +114,8 @@ |
105 | 115 | return array( |
106 | 116 | 'eventid' => null, |
107 | 117 | 'token' => null, |
108 | | - 'redirectto' => null |
| 118 | + 'redirectto' => null, |
| 119 | + 'additional' => null |
109 | 120 | ); |
110 | 121 | } |
111 | 122 | |
Index: trunk/extensions/UsabilityInitiative/ClickTracking/patch-additional_info.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +-- |
| 3 | +-- create click_tracking.additional_info |
| 4 | +-- |
| 5 | +ALTER TABLE /*_*/click_tracking ADD additional_info varbinary(255); |
Property changes on: trunk/extensions/UsabilityInitiative/ClickTracking/patch-additional_info.sql |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 6 | + native |