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

1event.target.dispatchEvent(
2   new CustomEvent('experience_interaction', {
3      bubbles: true,
4      composed: true,
5      detail: {
6         name: 'search',
7         searchQuery: input7.value,
8         attributes: {
9            searchFacetList: ['color', 'size'],
10            searchType: ['product'],
11            numberOfResultsRequested: 12,
12            resultPageOffset: 10,
13            sortType: 'asc',
14            correlationId: 'X-239-22-0',
15         },
16      },
17   })
18);