search-terms: what are people searching for?


Well-known member
is there any chance to see what people are searching for on my forum ?

I mean: as an Admin, can I se what kind of search-terms people are entering into the search-box ?


Jake Bunce

XenForo moderator
Staff member
Searches are cached in the xf_search table. Those records remain for up to 24 hours before they are pruned. You need to modify the code if you want those records to stay:


Add the red code to comment out that line:

Rich (BB code):
	public static function runDailyCleanUp()
		$db = XenForo_Application::get('db');

		// delete old thread/forum read marking data
		$readMarkingCutOff = XenForo_Application::$time - (XenForo_Application::get('options')->readMarkingDataLifetime * 86400);
		$db->delete('xf_thread_read', 'thread_read_date < ' . $readMarkingCutOff);
		$db->delete('xf_forum_read', 'forum_read_date < ' . $readMarkingCutOff);

		// delete old searches
		// $db->delete('xf_search', 'search_date < ' . (XenForo_Application::$time - 86400));
Or a more permanent solution would require an addon.


Well-known member
You can do a mysql query along the lines of

select search_query,user_id from xf_search where search_type NOT IN ("recent-threads","new-threads","user") AND search_query NOT Like "/search%" order by search_id desc limit 0,25;
Which would show you the last 25 search queries that were made in the last 24 hours (due to pruning)

This could also technically be turned into an addon but I don't have a need so won't be doing it myself.


Well-known member
I do not need it. The benefit is zero for me.
But Erich need everything. :D

well, I see people searching all the time at my forums and wondering what they are searching for, especially given the fact that any search-result is merely an Error-page saying "not found"......


Yep, only by admins would be nice, it helps determine what content we're missing. Even if this is a rolling 24h thing ..


Well-known member
@Deepmartini and @erich37
Piwik does what you want. In Piwik there is a page dedicated to internal search and you see the search terms and the bounce rate.

If you need help setting up Piwik or if you want Piwik hosting contact me.