1. Functions

widgetItemClick

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

Sends a widget item click event.

Signature

export async function widgetItemClick(
  widgetItemClickEventParams: WidgetItemClickEventParams
): Promise<void>

Parameters

NameTypeDescription
widgetItemClickEventParamsWidgetItemClickEventParamsData for widget item click events.

Return value

Returns a promise.

Examples

Example 69. Running the widgetItemClick 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 widgetItemClick function:

import { widgetItemClick } from "@sitecore-cloudsdk/search/browser";
import type { WidgetItemClickEventParams } from "@sitecore-cloudsdk/search/browser";

const eventParams: WidgetItemClickEventParams = {
  entity: {
    entity: "product",
    id: "1"
  },
  pathname: "/page",
  widgetId: "rfkid_7",
  itemPosition: 1,
  request: {
    keyword: "green",
    numResults: 3,
    totalResults: 3,
    numRequested: 10
  },
  page: "sample-page"
};

widgetItemClick(eventParams);

:::

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