diff options
author | Erik Bernhardson <ebernhardson@wikimedia.org> | 2016-02-15 12:49:37 -0800 |
---|---|---|
committer | Erik Bernhardson <ebernhardson@wikimedia.org> | 2016-03-04 11:53:39 -0800 |
commit | c1159337a96dca6251d9d2095cc3b53925a5d4e5 (patch) | |
tree | fbffbafead4f092a41ca5e5a8b9a458cd241ab49 /resources/src/jquery/jquery.suggestions.js | |
parent | 95b2be3bd3d95c5d0598e664a797cad8f216ba37 (diff) | |
download | mediawikicore-c1159337a96dca6251d9d2095cc3b53925a5d4e5.tar.gz mediawikicore-c1159337a96dca6251d9d2095cc3b53925a5d4e5.zip |
Add additional tracking information to mediawiki.searchSuggest
Adds a few pieces of information to improve tracking of autocomplete
usage.
* When using Special:Search 'go' feature forward wprov parameter to redirect
* Include a data attribute indicating autocomplete location to
differentiate usage of the header and Special:Search content autocompletes
* Report exact query string that was used for impression-results
* Add handling to allow searchSuggest subscribers to append tracking
information to generated article links
* Add a new hook, SpecialSearchGoResult, that can either change the url
redirected to in the 'go' feature or cancel it entirely.
Bug: T125915
Change-Id: Iec7171fcf301f1659d852afa87ce271f468177c1
Diffstat (limited to 'resources/src/jquery/jquery.suggestions.js')
-rw-r--r-- | resources/src/jquery/jquery.suggestions.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/resources/src/jquery/jquery.suggestions.js b/resources/src/jquery/jquery.suggestions.js index 01d9a43d61e4..1f977bf910e0 100644 --- a/resources/src/jquery/jquery.suggestions.js +++ b/resources/src/jquery/jquery.suggestions.js @@ -181,7 +181,7 @@ if ( +new Date() - cache[ val ].timestamp < context.config.cacheMaxAge ) { context.data.$textbox.suggestions( 'suggestions', cache[ val ].suggestions ); if ( typeof context.config.update.after === 'function' ) { - context.config.update.after.call( context.data.$textbox ); + context.config.update.after.call( context.data.$textbox, cache[ val ].metadata ); } cacheHit = true; } else { @@ -193,15 +193,16 @@ context.config.fetch.call( context.data.$textbox, val, - function ( suggestions ) { + function ( suggestions, metadata ) { suggestions = suggestions.slice( 0, context.config.maxRows ); context.data.$textbox.suggestions( 'suggestions', suggestions ); if ( typeof context.config.update.after === 'function' ) { - context.config.update.after.call( context.data.$textbox ); + context.config.update.after.call( context.data.$textbox, metadata ); } if ( context.config.cache ) { cache[ val ] = { suggestions: suggestions, + metadata: metadata, timestamp: +new Date() }; } |