Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Improved Search Logger: Edit Log

Here is the list of edits for this post
Improved Search Logger
Attached is a new version of the Search Logger. this has significant improvements over the old one.
  1. More compatible with Links' interrnal standard table structure
  2. 2.1 logic compatible
  3. Tracks both daily and total searches
  4. Can return daily totals
  5. Can return totals
  6. Can return the most recent hits
  7. Uses a function call <%Plugins::SearchLogger::Top_Keywords ('nn', 't|r|d')%> where 'nn' is the number of terms to return, and t,r,d stands for totals, recent, or daily hits where you can specify the # of terms to return.
  8. Delete old records from the admin by a date-older-than format.
  9. Copyrighted Freeware, no charge to use, but must credit the original sources ie: Gossamer-Threads & Pugdog Enterprises, Inc.


Once installed, it functions just as the original SearchLogger, but it maintains two tables. SearchLog and SearchLogDaily. The SearchLog table should still work with any globals you may have running off it. No guarantee, but it should -- as long as you are not using the ->get construct to call the records.

You use the plugin by inserting the function call into your template where you want the list of terms to reside.

<%Plugins::SearchLogger::Top_Keywords ('10')%>

Would return the 10 most search key words (same as if you used ('10', 't').

<%Plugins::SearchLogger::Top_Keywords ('10', 'd')%>

Would return the top 10 keywords for that day, starting at midnight (not a 24 hour span, a calendar day)

<%Plugins::SearchLogger::Top_Keywords ('11', 'r')%>

Would return the most recent 11 searches, even if they spanned several days.

If there are fewer than the requested number of records for the daily search, it returns only what it finds.

This new logic allows easy addition of other features, and I have a few I'm working on.

Known limitations are:
  • Daily totals reset at midnight, your server's time, can be potentially confusing. Need to expand this a bit.
  • Works with dynamic pages -- such as page.cgi, search, etc.
  • Static pages will have a 'snapshot' of the time they were created. I'm not sure how this could be expanded to allow an SSI call, other than moving that routine to a small .cgi script that can be included in the static page. I don't use, and never have, SSI, so I don't have any practical experience there.
  • HTML has to be edited in the .pm file because it's variable (not token) substitutions. I'll look at making that a parsed call, but that would mean additional overhead in the templates where the plugin function returns an array of values you have to loop through, like you do the links. In that case, output could be defined in your templates. It starts getting "messy" the more you try to do, and the whole goal was to create a _simple_ tag that would insert the top keywords easily. I guess, I could maybe (try?) to do something like <%Plugins::SearchLogger::Top_Keywords ('10', 't', 'noloop')%> and have it default to 'loop' (where you'd have to take the results and stick them in a <%loop%> construct to change the output format. ?? maybe.


Anyway... it works -- or seems to, with major bugs swatted. So let me know.



If you have SearchLogger installed, the best way to install this, is to open up MySQL Man, and go to the SQL Dump area. Select the 'dump specific tables' and select only the 'SearchLogger' table. Select don't write tables, and then select 'Use INSERT statements that name each column to be inserted. ' This will save the contents of the SearchLogger table. Named columns are _important_.

Once you are sure you have this file of data saved, you can _FULLY_ uninstall the SearchLogger program, upload this new version, then install this version.

Import your saved data from step one, by either loading from file or pasting into the SQL Monitor box. (Depends on how much you have in the file)

There should be _no_ problems with your current install! Nothing has been changed, other than a new SearchLogger.pm was written to your Plugins directory, and your Plugins.cfg was updated with the additional hooks for the admin.

To start to use the program, you follow the steps above.

To change the output, you can (pretty safely) edit the SearchLogger.pm file. The only line that would need to be edited is:

$output .= qq~ <LI><a href="$db_cgi_url/search.cgi?query=$term_q">$term</a> ~;

(ONLY edit the stuff between the ~ marks)

If you don't want the List format, you also need to delete the two lines:

$output .= '<UL>';

and

$output .= '</UL>';






PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.

Last edited by:

pugdog: Dec 29, 2001, 10:21 PM

Edit Log: