scriptygoddess

11 Sep, 2002

Record MTSearch terms

Posted by: promoguy In: MT hacks

If you use the amazing MTSearch add-on, then here is an awesome companion tool.

Graham has put together a way for you to make a text file (or web page) of the search terms visitors to your site use in the MTSearch tool.

Click here to read the hack.

I actually have had difficulty getting it to work, but several others have had great success. If you get it running, be sure and let me know in your comments. Don't be suprised if I start asking you how to get it working for my site!

Enjoy!

UPDATE: Already posted? Dagnabbit! Well, my next post will be better!

9 Responses to "Record MTSearch terms"

1 | Jennifer

September 11th, 2002 at 3:50 pm

Avatar

Promo (by the way, you need to update you "nickname" so you get credit for your posts…)

you asked me if we posted a link to this, my bad – apparently we did (although, funny it didn't come up when I did a search for "search" ???!!!)

2 | Keith

September 12th, 2002 at 12:35 am

Avatar

Just stopping by. Lovely site!

3 | robyn

September 12th, 2002 at 3:56 am

Avatar

I didn't get it to work either — I wonder if it's either a mySQL or Blogomania/HM thing?

4 | Christine

September 12th, 2002 at 2:34 pm

Avatar

More than likely a MySQL/mt-search issue rather than a server issue. Has anyone contacted the original author to see if he has a fix for the MySQL version?

5 | robyn

September 12th, 2002 at 3:27 pm

Avatar

I'm not so sure Christine — at Promo's suggestion I just tried it on Todd's blog which still uses the DB method, and unless I just did it horribly wrong, it still gave the same Internal Server Error it gave me using mySQL.

6 | kristine

September 13th, 2002 at 3:35 pm

Avatar

I wanted to play with this, but decided to wait until sometime later this month because MT2.5 will have the MT search integrated into it. :)

7 | David

September 16th, 2002 at 9:54 pm

Avatar

I took the liberty of extending the hack a little.

I added display of the date, supression of logging blank searches, and an error exit if the log file can't be written to.

Here's my version:

# Log the search request

# Ideally the two variables that follow would be in the mt-search.cfg file and read from there
# But I don't know how to do that
# But the rest of the hack is written to allow for that future enhancement

my $uselog = 1; # 1 = YES; 0 = NO
my $logfile = "/full/path/to/log/file";

# Only write to log if configured to do so
if ($uselog eq '1') {
# Only write to log is search string is not null
if ($searchstr ne "") {
# Open the log file or display error and stop
open (LOG, "&gt&gt$logfile") or die "Can not open file $logfile: $!";
# Get the system date
my $date = `date`;
# Remove the carriage return from the date string
chop($date);
# Write the data to the file
print LOG "$date";
print LOG " – ";
print LOG "$searchstr\n";
# Close the log file
close (LOG);
}
}

# End of logging hack

I posted this on Graham's site too, but thought I'd put it here, since this is what led me to the hack originally.

8 | Promo

September 25th, 2002 at 11:55 am

Avatar

Odd that it works for some folks and not for others. I wonder what the secret is?

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements