Search Interactions

A search interaction occurs when a user performs a search on your site.
Interaction Name Description
category-search Captures an event that occurs when a user selects a category during a search. Available in package version 1.3 and later.
search Captures a search event on your site.

Fields

Field Details
attributes
Type
object
Description
A dictionary of values that you supply.
categoryId
Type
string
Description
The ID of a category from a commerce site that the site visitor selects. Must be classified as a category-based search.
name
Type
string
Description
Required. The event name.
searchQuery
Type
string
Description
A value that the site visitor supplies representing a search query.

Search Event

event.target.dispatchEvent(
   new CustomEvent('experience_interaction', {
      bubbles: true,
      composed: true,
      detail: {
         name: 'search',
         searchQuery: input7.value,
         attributes: {
            searchFacetList: ['color', 'size'],
            searchType: ['product'],
            numberOfResultsRequested: 12,
            resultPageOffset: 10,
            sortType: 'asc',
            correlationId: 'X-239-22-0',
         },
      },
   })
);