GlideSPSearchAnalytics - Global
-
- UpdatedJan 30, 2025
- 6 minutes to read
- Yokohama
- API reference
The GlideSPSearchAnalytics API provides methods to generate search analytics from custom ServiceNow search widgets.
By default, the Search Events [sys_search_event] and Search Source Events [sys_search_source_event] tables collect search data from base system search widgets. However, custom search widgets do not benefit from this feature. Use this API in the server script of custom search widgets in global environments to send search data to the search events tables. Generate relevant search suggestions for your users and monitor search analytics to understand what your users are searching for and whether they're finding what they need.
- Searched terms
- Rank of clicked items
- Filters used to refine search results
- Table names and record identifiers from the first page of search results
- Search results clicked, including browser and location
Search Suggestions is a Now Platform feature. For more information, see Search Suggestions.
GlideSPSearchAnalytics - publish(String payload)
Sends search data to the Search Event [sys_search_event], Search Event per source [sys_search_source_event], and Search Signal Event [sys_search_signal_event] tables for search results, or to the Search Result Clicked [sys_search_result_clicked] and Search Signal Result Event [sys_search_signal_result_event] tables when a user clicks a search result.
Name | Type | Description |
---|---|---|
payload | String | JSON payload in String format containing the search data to send to the Search
Event [sys_search_event], Search Event per source [sys_search_source_event], and
Search Signal Event [sys_search_signal_event] tables for search results, or to the
Search Result Clicked [sys_search_result_clicked] and Search Signal Result Event
[sys_search_signal_result_event] tables when a user clicks a search result.
Structure the payload as key-value pairs according to the type of search data you
would like to collect.
|
Type | Description |
---|---|
None |
Example
This example passes direct search data to the search analytics tables.
Example
This example dynamically collects direct search data from a custom search widget and passes it to the search analytics tables.
Example
This example collects direct search-results-clicked data from a custom search widget and passes it to the search analytics [sys_search_result_clicked] table.