Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize developer documentation
  • Developing with Sitecore Personalize
            • Boxever.eventCreate(event, callback, format)
            • Boxever.callFlows(flow, callback)
            • Boxever.addUTMParams(event)
            • Boxever.browserCreate(object, callback, format)
            • Boxever.browserShow(browserId, clientKey, callback, format)
            • Boxever.getBucketNumber([callback])
            • Boxever.getClientKey()
            • Boxever.getCookie(cookieName)
            • Boxever.getID()
            • Boxever.reset()
            • Boxever.setCookie(cookieName, cookieValue[, expiresIn])
            • Boxever.templating()
            • Boxever.triggerExperiences()
        • Troubleshooting
        • Release notes
  1. Functions
  1. Stream API
  2. Functions
  3. Boxever.getBucketNumber([callback])

Boxever.getBucketNumber([callback])

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

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 Personalize using the Boxever JavaScript Library.

Parameters

Parameter

Type

Description

Note

[callback]

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 Personalize using the getBucketNumber() function and log the bucket number cookie to the console using the getCookie() function.

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

Then, you call the reset() function to reset the guest reference:

Boxever.reset();

Sitecore Personalize 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 Personalize again using the getBucketNumber() function. Then, you log the bucket number cookie to the console using the getCookie() function:

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

The bucket number cookie is now different.

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

Documentation Assistant

This assistant uses AI to generate responses based on Sitecore documentation. While it has access to official sources, answers may be incomplete or inaccurate and should not be considered official advice or support.
Powered by
k
kapa.ai
Protected by reCAPTCHA

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use