1. Functions

widgetFacetClick

Version:
TypeFunction
Import path@sitecore-cloudsdk/search/browser

Sends a facet click event.

Signature

export async function widgetFacetClick(
  widgetFacetClickEventParams: WidgetFacetClickEventParams
): Promise<EPResponse | null>

Parameters

NameTypeDescription
widgetFacetClickEventParamsWidgetFacetClickEventParamsData for facet click events.

Return value

Returns a promise.

Examples

Example 70. Running the widgetFacetClick function

Note

To run this function, you have to first initialize the Cloud SDK.

See more examples and other data you can include in the event.

Here's an example of how to use the widgetFacetClick function:

import type { WidgetFacetClickEventParams } from "@sitecore-cloudsdk/search/browser";
import { widgetFacetClick } from "@sitecore-cloudsdk/search/browser";

const eventData: WidgetFacetClickEventParams = {
  filters: [
    {
      displayName: "Color",
      facetPosition: 1,
      name: "color",
      title: "Color",
      value: "Blue",
      valuePosition: 2
    }
  ],
  request: {
    keyword: "green",
    numResults: 3,
    totalResults: 3,
    numRequested: 10
  },
  pathname: "/search",
  widgetId: "rfkid_7"
};

widgetFacetClick(eventData);

:::

If you have suggestions for improving this article, let us know!