Introduction¶
Get information about what visitors search for when they use the search feature on your website. Track the actions that visitors take, if any, after they perform a search. This information is tracked by the Web Governance Statistics module.
Use this data to make informed decisions about website content and determine if you need to add, remove, or adjust content to meet the needs of your visitors.
This feature lets you:
- View a list of all terms that visitors search for.
- View the number of times (occurrences) that each term was searched for.
- View the average amount of search result pages that visitors receive for each term.
- For each term, view the percentage of visitors who leave the website immediately after they perform a search.
- Filter data based on:
- Search term
- Number of occurrences
- Percentage of search exits.
- Download/export site search data.
- Apply a date range filter to site search data.
- Search for a specific search term.
- Visualize site search data in a bar chart (the number of entries will often be in the 100s or 1000s).
Prerequisites¶
This section provides information about what is needed for the scan to be able to track searches on your website.
- The script needs to be present on your website, and the Statistics feature needs to be enabled.
For instructions, visit: - Your website must have a search option. When a user does a search, the search results must be displayed on a dedicated search results page. The search results page must use a URL parameter that contains the search query.
For example, if a visitor searches for the word "holiday", the search results page URL must contain "holiday". It could be something like: domain.com/search?search=holiday or domain.com/s?q=holiday, and so on. - You must be able to add a script to your search results page.
Site Search setup¶
This section provides instructions on how to set up Site Search.
- In your CMS (website builder software), locate your search results page.
Add the following script to your search results page in the <body> tag:
<script>
window.addEventListener('mon-script-loaded', () => {
const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries());
if (params.searchString) { window.monsido_functions.trackSearch(params.searchString);
}
});
</script>
Modify the script so that it can track site searches properly. Replace searchString in the snippet above with the search query parameter that is used on your website.
To find this, do a search on your website and look at the URL of your search results page. The search query parameter name typically appears between the characters ? and = in the URL. Here are two examples:
Example 1
On this search results page, the query parameter name is keys.
Example 2
On this search results page, the query parameter name is cludoquery.
Notice that searchString appears in two places in the script and you must replace it in both places.
If the query parameter name is keys, modify the script in the following way:
<script>
window.addEventListener('mon-script-loaded', () => {
const urlSearchParams = new URLSearchParams(window.location.search); const params = Object.fromEntries(urlSearchParams.entries());
if (params.keys) { window.monsido_functions.trackSearch(params.keys);
}
});
</script>
For more information, visit Tracking in the Developers documentation section.
- Publish your website. The scan can now track site searches.
- In
Statistics > Content > Site Search, you can view a list of the terms and phrases that visitors have searched for. The table contains the following information:- Search term: This field shows the exact word or phrase that visitors searched for.
- Searches: This field shows the number of times the particular term has been searched for.
- Average no. of results pages viewed: This field shows the average number of search results pages that your visitors viewed for the search term. To track this data, you need an advanced script setup. For more information, visit Tracking in the Developers documentation section.
- % of search exits: This field shows the percentage of visitors who left the website (bounced) immediately after they did the search.
It may take up to 24 hours for search data to appear in the application interface after a visitor does a search.
How to use Site Search¶
For information on how to use Site Search, visit Site Search.