Search code examples
phpmysqlsearchloggingsearch-engine

How would I log searches on my PHP/MySQL website?


When someone searches my website using a quick search feature I would like to log this into my database

  1. Obviously I want to see what my users are searching for
  2. I can create a 'tag cloud' based on these searches

I have a table searchterms at the moment with two fields: id and terms, I was wondering if this was the best method of logging this info. Terms is becoming a bit redundant however.

any clues or links to relevant scripts?

Thanks guys


Solution

  • I haven't tried but google analytics provides the option to track what users enter in your search box. For displaying there's the developer API.

    The caveat is this would all be javascript. The advantage is that it would lessen the load on the server.

    Maybe not what you were looking for but worth mentioning.