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



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:

window[’_paq’].push( [ ‘trackSiteSearch’,, ‘SearchTerm’, ] )

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

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

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

Thanks in advance and best regards.