---
title: "widgetView"
slug: "cloud-sdk-search-browser-widgetview"
abstract: "The widgetView function sends a widget view event from the browser side."
---
# widgetView

|     |     |
| --- | --- |
| Type | Function |
| Import path | `@sitecore-cloudsdk/search/browser` |

Sends a [widget view event](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-concepts/concepts-tracking/events/sitecore-search-events.html "Sitecore Search events").

## Signature

```typescript
export async function widgetView(
  widgetViewEventParams: WidgetViewEventParams
): Promise<void>
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `widgetViewEventParams` | [`WidgetViewEventParams`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-widgetvieweventparams.html "WidgetViewEventParams") | Data for [widget view events](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-concepts/concepts-tracking/events/sitecore-search-events.html "Sitecore Search events"). |

## Return value

Returns a promise.

## Examples

:::tab{title="Next.js"}

Example 68. Running the widgetView function

:::tab{title="Next.js"}
> [!note]
> To run this function, you have to first [initialize](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/functions/cloud-sdk-core-browser-cloudsdk.html "CloudSDK") the Cloud SDK.
>
> See [more examples](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/functions/sitecore-search-events.html "Sitecore Search events") and [other data](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/functions/cloud-sdk-search-widgetvieweventparams.html "WidgetViewEventParams") you can include in the event.

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

```typescript
import { widgetView } from "@sitecore-cloudsdk/search/browser";
import type { WidgetViewEventParams } from "@sitecore-cloudsdk/search/browser";

const eventData: WidgetViewEventParams = {
  request: {
    keyword: "green",
    numResults: 3,
    totalResults: 3,
    numRequested: 10
  },
  entities: [
    {
      entity: "product",
      id: "1"
    },
    {
      entity: "product",
      id: "2"
    },
    {
      entity: "product",
      id: "3"
    }
  ],
  pathname: "/page",
  widgetId: "rfkid_7"
};

widgetView(eventData);
```

:::

:::