I recently implemented a search box in my site and it gives good result with auto complete of keywords. I want to implement a hidden part to know what the search queries are that my registered visitors searched for.
I added a hidden username in the search box and when the user searches for anything, the name and search queries are saved in another table. Because of auto complete, the data is saved every second; so if someone searches for "Laptop", we get:
**ID username Searchdata srtime**
1 user1234 L 1372513199
2 user1234 La 1372513200
3 user1234 Lap 1372513201
4 user1234 Lapt 1372513202
5 user1234 Lapto 1372513203
6 user1234 Laptop 1372513204
jQuery code:
$('#search_box').keyup(function() {
// Other things
});
How can I save only the final search term and ignore the auto complete values?