1. @sitecore-cloudsdk/core/browser

getBrowserId

Version:

Type

Function

Import path

@sitecore-cloudsdk/core/browser

Returns the browser ID from the sc_cid cookie. Used for testing and debugging purposes.

Signature

export function getBrowserId(): string

Return value

Returns the browser ID.

Examples

Example 28. Running the getBrowserId function

Next.js

Here's an example of how to use the getBrowserId function to log the browser ID to the console:

"use client"; // Used only in Next.js App Router
import { useEffect } from "react";
import { getBrowserId } from "@sitecore-cloudsdk/core/browser";

export default function Component(){
  useEffect(() => {
    console.log("bid:", getBrowserId());
  }, [])

  return (<></>);
};


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