Because Statamic's search features do not emit any events, you will need to update your site's search results page in order to log searches. This can be done by inserting the {{ log_search /}}
Antlers tag within your existing template:
1{{ search:results }}2 {{ log_search /}}3{{ /search:results }}
Note: In the event something has been misconfigured or is not working correctly, the log_search
tag will log all exception's to your site's default log. It will not display the exception within the browser.
This will instruct Search Report for Statamic to create a new log entry after a response has been sent to your site's visitor. The log_search
tag will attempt to find all its required information automatically, but this behavior can also be changed.
The following parameters are available when using the log_search
tag:
1{{2 log_search3 term="the searched term"4 index="the-search-index"5 site="default"6 result_count="0"7 page="1"8/}}
Name | Description |
---|---|
term | The user's search query. |
index | The search index used to perform the search. |
site | The site the search was performed within. |
result_count | The total number of results returned. |
page | The current page number, when using paginated results. |
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.