---
title: "Boxever.getBucketNumber([callback])"
slug: "bx-getbucketnumber"
abstract: "Describes the getBucketNumber() function in the Boxever JavaScript Library (Sitecore CDP Stream API)."
---
# Boxever.getBucketNumber(\[callback\])

The `getBucketNumber()` function updates the bucket number cookie in the browser to match the latest bucket number in Sitecore CDP. Call this function after an IDENTITY event triggers. This updates the cookie in the browser to match the bucket number in Sitecore CDP.

> [!note]
> This function is specific to Web Experiences and Web Experiments in Sitecore Personalize, and it is only available if you specified `web_flow_target` when you integrated with Sitecore CDP using the Boxever JavaScript Library.

## Parameters

| Parameter | Type | Description | Note |
| --- | --- | --- | --- |
| `[callback]`<br><br>optional | function | This callback function handles the response. | N/A |

## Return value

undefined

## Example

This example describes how to test that the `getBucketNumber()` function updates the bucket number cookie in the browser.

First, you get the latest bucket number from Sitecore CDP using the `getBucketNumber()` function and log the bucket number cookie to the console using the `[getCookie()](bx-getcookie.md "Boxever.getCookie(cookieName)")` function.

```javascript
Boxever.getBucketNumber(() => console.log(Boxever.getCookie("bx_bucket_number")));
// 49

```

Then, you call the `[reset()](bx-reset.md "Boxever.reset()")` function to reset the guest reference:

```javascript
Boxever.reset();

```

Sitecore CDP creates a new guest reference and assigns a bucket number to this guest. But the bucket number cookie in the browser stays unchanged.

To update the cookie in the browser, you get the latest bucket number from Sitecore CDP again using the `getBucketNumber()` function. Then, you log the bucket number cookie to the console using the `[getCookie()](bx-getcookie.md "Boxever.getCookie(cookieName)")` function:

```javascript
Boxever.getBucketNumber(() => console.log(Boxever.getCookie("bx_bucket_number")));
// 21

```

The bucket number cookie is now different.