Search tracking | Track searchTerm and possible filter option in a clever way

Hello,

we are implementing search tracking in a media gallery. This media gallery has a conventional search (search term can be entered) and additional a filter where user can filter the media by keywords or categories. The search and the filter can be used together.

Currently we track the search and the filter selection as a combination. So the result looks something like searchTerm + selectedCategory + selectedKeyword in case the user made use of all search and filter possibilities.

This is how the current implementation looks like:

searchTerm
window[’_paq’].push( [ ‘trackSiteSearch’, options.data.searchTerm, ‘SearchTerm’, options.data.results ] )

Categories (channels) - we map the Ids to the category name and append them as strings
window[’_paq’].push( [ ‘trackSiteSearch’, options.data.channels.map( channel => channel.channelTitle ).join(’, '), ‘Channels’, options.data.results ] )

#Watch detail view
window[’_paq’].push( [ ‘trackEvent’, ‘Action’, ‘DetailView’, options.data.mediaContainerId ] )

I am wondering if there’s a better way to track searches which can be grouped?

Thanks in advance and best regards.