Engage.init(settings)
The asynchronous init() function initializes the Engage SDK on the client side of your app. Call this function after the window object is defined and before you call any other Engage functions.
During initialization, the function creates a browser ID and stores it as a cookie in the browser.
Here's an example of how to use the init() function. You must call the init() function asynchronously and save the return value into a variable.
Here's an example of how to use the init() function in a React app. You must call the init() function asynchronously and save the return value into a variable.
You can expose Engage functions to the window object by assigning the return value to the window object. You must do this in order to call Engage functions inside your web experience or web experiment in Sitecore Personalize.
In production, you should call the init() function once, then share it across the app using the state management solution of your choice, for example, React Context or Redux.
engage.js:
App.js: