• Adds userId and manifest as set-cookie headers to the response

    addStateToResponse is a useful helper method that takes a response object and adds cookies to track the user. It also adds a cookie to track the current manifest for the user.

    The helper is typically used in an edge function to track the user state. When used this way, it also allows the Personalize SDK to be initialized in the browser without making a call to fetch the manifest.

    Call this method after initializing the SDK.

    Parameters

    • response: Response

      A Web standard response object

    Returns Promise<void>

    await Personalize.addStateToResponse(response);