Skip to Navigation | Skip to Content

Search Analytics

Conversations with your customers

Title In Progress

Sample Code/Templates

This simple and free PERL script (5Kb download) reads your Web search engine's log and produces a report listing your most popular search phrases in rank order. You will need to gain access to the log or a copy of it. Run this script with the log as your input, and the report will be your output. You may need to tweak the script a bit depending on the idosyncracies of your search engine's log format. A number of institutions have run this script as a low-overhead way to gain basic insight into search patterns. You might want to run the script periodically--say, once a month. With the help of your server administrator, you might be able to automate periodic running of this report.

We're also looking for versions of this script in other languages, such as Python, Ruby, and Visual Basic. If you'd like to code this script in another language and share it, we'll be more than happy to host it here and fully attribute your great work.

Comments

the loganalyzer script wouldn't run until i removed the "numerically" and "logdatewise" words after the sort keywords in lines 81 & 93.

otherwise perl would give an error message:
Undefined subroutine in sort at ./loganalyzer.pl line 81, line 7283.

$ ./loganalyzer.pl

Number of queries with n search terms:
Illegal division by zero at ./loganalyzer.pl line 87, line 1475.

Post a comment

We’ve enabled comment moderation on Rosenfeld Media. Upon posting your comment, it will not immediately appear on this page. Hang tight, we’ll be sure to screen it before too long. (Starred fields are required)