Index: trunk/extensions/ClickTracking/patches/ClickTrackingUserProperties.sql |
— | — | @@ -14,7 +14,10 @@ |
15 | 15 | property_value varbinary(255), |
16 | 16 | |
17 | 17 | -- property version |
18 | | - property_version INTEGER |
| 18 | + property_version INTEGER, |
| 19 | + |
| 20 | + UNIQUE KEY id_name_value_version (session_id, property_name, property_value, property_version) |
| 21 | + |
19 | 22 | ) /*$wgDBTableOptions*/; |
20 | 23 | |
21 | 24 | CREATE INDEX /*i*/click_tracking_user_properties_session_idx ON /*_*/click_tracking_user_properties (session_id); |
\ No newline at end of file |
Index: trunk/extensions/ClickTracking/ApiClickTracking.php |
— | — | @@ -25,7 +25,8 @@ |
26 | 26 | $this->validateParams( $params ); |
27 | 27 | $eventid_to_lookup = $params['eventid']; |
28 | 28 | $sessionId = $params['token']; |
29 | | - |
| 29 | + $namespace = $params['namespacenumber']; |
| 30 | + |
30 | 31 | $additional = null; |
31 | 32 | |
32 | 33 | if ( isset( $params['additional'] ) && strlen( $params['additional'] ) > 0 ) { |
— | — | @@ -50,7 +51,7 @@ |
51 | 52 | ClickTrackingHooks::trackEvent( |
52 | 53 | $sessionId, // randomly generated session ID |
53 | 54 | $isLoggedIn, // is the user logged in? |
54 | | - $wgTitle->getNamespace(), // what namespace are they editing? |
| 55 | + (int)$namespace, // what namespace are they editing? |
55 | 56 | $eventId, // event ID passed in |
56 | 57 | ( $isLoggedIn ? $wgUser->getEditCount() : 0 ), // total edit count or 0 if anonymous |
57 | 58 | $granularity1, // contributions made in granularity 1 time frame |
— | — | @@ -85,7 +86,7 @@ |
86 | 87 | * @param $params params extracted from the POST |
87 | 88 | */ |
88 | 89 | protected function validateParams( $params ) { |
89 | | - $required = array( 'eventid', 'token' ); |
| 90 | + $required = array( 'eventid', 'token', 'namespacenumber' ); |
90 | 91 | foreach ( $required as $arg ) { |
91 | 92 | if ( !isset( $params[$arg] ) ) { |
92 | 93 | $this->dieUsageMsg( array( 'missingparam', $arg ) ); |
— | — | @@ -97,6 +98,7 @@ |
98 | 99 | return array( |
99 | 100 | 'eventid' => 'string of eventID', |
100 | 101 | 'token' => 'unique edit ID for this edit session', |
| 102 | + 'namespacenumber' => 'the namespace number being edited', |
101 | 103 | 'redirectto' => 'URL to redirect to (only used for links that go off the page)', |
102 | 104 | 'additional' => 'additional info for the event, like state information' |
103 | 105 | ); |
— | — | @@ -112,12 +114,14 @@ |
113 | 115 | return array_merge( parent::getPossibleErrors(), array( |
114 | 116 | array( 'missingparam', 'eventid' ), |
115 | 117 | array( 'missingparam', 'token' ), |
| 118 | + array( 'missingparam', 'namespacenumber'), |
116 | 119 | ) ); |
117 | 120 | } |
118 | 121 | |
119 | 122 | public function getAllowedParams() { |
120 | 123 | return array( |
121 | 124 | 'eventid' => null, |
| 125 | + 'namespacenumber' => null, |
122 | 126 | 'token' => null, |
123 | 127 | 'redirectto' => null, |
124 | 128 | 'additional' => null |
Index: trunk/extensions/ClickTracking/modules/jquery.clickTracking.js |
— | — | @@ -28,6 +28,7 @@ |
29 | 29 | $.post( |
30 | 30 | mediaWiki.config.get( 'wgScriptPath' ) + '/api.php', { |
31 | 31 | 'action': 'clicktracking', |
| 32 | + 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
32 | 33 | 'eventid': id, |
33 | 34 | 'token': $.cookie( 'clicktracking-session' ) |
34 | 35 | } |
— | — | @@ -44,6 +45,7 @@ |
45 | 46 | mediaWiki.config.get( 'wgScriptPath' ) + '/api.php', { |
46 | 47 | 'action': 'clicktracking', |
47 | 48 | 'eventid': id, |
| 49 | + 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
48 | 50 | 'token': $.cookie( 'clicktracking-session' ), |
49 | 51 | 'additional': info |
50 | 52 | } |
— | — | @@ -60,6 +62,7 @@ |
61 | 63 | return mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?' + $.param( { |
62 | 64 | 'action': 'clicktracking', |
63 | 65 | 'eventid': id, |
| 66 | + 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
64 | 67 | 'token': $.cookie( 'clicktracking-session' ), |
65 | 68 | 'redirectto': url |
66 | 69 | } ); |
Index: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js |
— | — | @@ -40,7 +40,9 @@ |
41 | 41 | |
42 | 42 | $.setBucket = function ( bucketName, bucketValue, bucketVersion ){ |
43 | 43 | var bucketCookies = $.getBuckets(); |
| 44 | + alert("HELLOA"); |
44 | 45 | if(!bucketCookies) { bucketCookies ={};} |
| 46 | + alert("HELLOB"); |
45 | 47 | bucketCookies[ bucketName ] = [ bucketValue, bucketVersion ]; |
46 | 48 | $j.cookie('userbuckets', JSON.stringify( bucketCookies ) , { expires: 365 }); //expires in 1 year |
47 | 49 | bucketCookies = $.getBuckets(true); //force it to rerun and update |
— | — | @@ -77,7 +79,7 @@ |
78 | 80 | } |
79 | 81 | |
80 | 82 | // do the actual code in the campaign based on the bucket |
81 | | - if($.getBuckets()[campaign.name] && $.getBuckets()[campaign.name][0] != "none"){ |
| 83 | + if($.getBuckets() && $.getBuckets()[campaign.name] && $.getBuckets()[campaign.name][0] != "none"){ |
82 | 84 | campaign[$.getBuckets()[campaign.name][0]](); //function to execute |
83 | 85 | if(campaign.allActive){ |
84 | 86 | campaign.allActive(); |