Searched
I added a plugin for my personal use, Searched. It shows when a post is shown when the referrer is a search engine (currently accepts non-cached referrals from google, yahoo and msn… the 3 most popular search engines).
It adds a record that the search was linked to X post, then when the post is displayed, it will show the search queries leading to that post. For example:
Searches from search engines leading to this post:
1. [Footmen Frenzy] (8)
2. [footmen frenzy 3.8] (3)
3. [Footmen Frenzy ] (1)
4. ["footmen frenzy"+"3.8"] (1)
In conjunction with that functionality, I added the showing of 10 most searched pages, for sidebars.
I find it very interesting to see what search engine queries lead to my site.
If there are a few people that also want this, I can publish my ~2-3 hours of work. Otherwise, I see no need to make it public.
Edit 8/30:
There were 160,000 searches total, but I noticed that LOTS of them are misfiled. This is not necessarily the fault of this plugin, more the fault of Google misfiling results to searches. I ran two queries to slim the searches down:
First:
DELETE FROM {table} WHERE post='0'
For some reason I’m saving as post=’0′ when a search is logged, but a non-single page is loaded. I cleared this, someday I might use this but I doubt it. I’ll keep it in there for now.
Second:
DELETE FROM {table} WHERE search LIKE('%dota%') AND
(! the dota posts)
Where “! the dota posts” is obviously pseudocode meaning it’s not any of the posts that are returned when I do a local search for “dota”. At the time of this posting, those posts were
post != '393' AND post !='376' AND post !='374' AND post !='370' AND post !='367' AND post !='365' AND post !='356' AND post !='345' AND post !='325' AND post !='322' AND post !='306' AND post !='304' AND post !='303' AND post !='144'
It looks like there were only about 16,000 posts (10%) that were misfiled, which actually isn’t TOO bad.
I also changed it so that it shows the top 25 posts instead of top 100. If I ever publish this (which I kind of doubt at this point, unless requested), I’ll make that configurable of course.
Edit 8/9:
Decided to only show the top 100 search queries going to each post, so that there are no longer many thousands of results shown for some posts.
Edit 8/8:
Broke 100,000 searches! 10,000 of them are leading to the “main page” and are not linked to any post in particular. These have been flushed.
Update 7/12:
Made it so that the search results aren’t loaded unless is_page or is_single is true; meaning when viewing the main page or a category page it won’t show all of the search results. All of the results will only be shown when the post is viewed by itself. This should cut down on some load times and queries.
Update 7/11:
I’ve added links back to each search engine so you can click to get to each one.
Update 7/6:
Many “special characters” are left in url-encoded form. I had translated some out of it, but there are a lot of them, so they weren’t all translated. That is why you’d see some search results having a “%27″ or some similar set of characters in it. I have found a php function that does this for me, so all should now be properly decoding.
Update 6/23:
I added a link back to this post on all of the search sections.
Update 6/20:
I made it so that it will only log a search if “is_page” or “is_single”, so all of the improperly logged searches will no longer show. This should greatly reduce the number of results, but it will be much more accurate. So if someone searches for the site and they come to a category archive, a month archive, or the main page (”/”), it will not show under any post. I will work on a “Searches leading to the site” section, perhaps.
I also provided an update for the problem that was possibly created from the 6/13 update regarding SEO. If the user agent has “bot” in it, it will expand the search list, otherwise it will not be expanded.
Update 6/13:
I added support for hiding the searches and showing a total on each searched page. I’ve found that having the searches available in plain sight actually helps for SEO (search engine optimization), ranking the page higher on a search engine. If making them “invisible” until the button is clicked affects that SEO, I will remove it or look for another method.
