Facet click events
The facet click event tracks when the site visitor clicks a facet value in your app, on the search results page. For example, when the site visitor narrows down the search results for shoes by clicking the Blue value in the color facet, the 43 value in the size facet, and the UrbanNomadTrainers value in the brand facet.
You can send facet click events by using the widgetFacetClick function and passing it the facet click event data object.
The facet click event data object
The facet click event data object represents all the required and optional data about the event.
This is the object where you provide data about the event. All this data is sent to Sitecore Search, so make sure to provide the correct data depending on your organization's requirements. Construct the object in the following way:
-
Provide the ID of the widgetID of the widget that was clicked, data about the filter values that were clicked, and the URI where the event triggered.
-
Optionally, you can provide data such as the channel and the language of the page where the event triggered.
Examples
During development, use your web browser's developer tools to check the payload containing all the event data that is sent to Sitecore.
Here's an example event data object for a facet click event. The object contains all the required and some optional event data. You can send this event by passing the object to the widgetFacetClick function:
For this facet click event data object, the following payload is sent to Sitecore: