---
title: "widgetNavigationClick"
slug: "cloud-sdk-search-server-widgetnavigationclick"
abstract: "The widgetNavigationClick function sends a widget navigation click event from the server side."
---
# widgetNavigationClick

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

Sends a [navigation click 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 widgetNavigationClick(
  widgetNavigationClickEventParams: WidgetNavigationClickEventParams
): Promise<void>
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `widgetNavigationClickEventParams` | [`WidgetNavigationClickEventParams`](https://doc.sitecore.com/sdk/en/developers/005/cloud-sdk/cloud-sdk-reference/cloud-sdk-search/cloud-sdk-search-browser/interfaces/cloud-sdk-search-widgetnavigationclickeventparams.html "WidgetNavigationClickEventParams") | Data for [navigation click 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 78. Running the widgetNavigationClick 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-server/functions/cloud-sdk-core-server-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-server/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-server/functions/cloud-sdk-search-widgetnavigationclickeventparams.html "WidgetNavigationClickEventParams") you can include in the event.

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

```typescript
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { CloudSDK } from "@sitecore-cloudsdk/core/server";
import { widgetNavigationClick } from "@sitecore-cloudsdk/search/server";
import type { WidgetNavigationClickEventParams } from "@sitecore-cloudsdk/search/server";

export default async function middleware(request: NextRequest) {
  const response = NextResponse.next();

  // Initialize the SDK and the package...

  // Send event:
  const eventData: WidgetNavigationClickEventParams = {
    widgetId: "rfkid_2",
    pathname: "/rec",
    itemPosition: 1
  };

  const widgetNavigationClickResponse = await widgetNavigationClick(request, eventData);
  console.log("Sent widget navigation click event.", widgetNavigationClickResponse);

  return response;
};
```

:::

:::