-
-
Save neilkillen/2699cb5c522dcfd0c4c6f35659bcdf16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function is used to Get the Browser Ref from Sitecore Personalize | |
* @returns browserId | |
*/ | |
async function getBrowserRef() | |
{ | |
let browserId = ""; | |
var result = null | |
try | |
{ | |
let request = `https://${cdpEndpoint}xx/v1.2/browser/create.json?client_key=${clientKey}&message={}` | |
const response = await fetch(request, {method: 'GET'}); | |
if (response.ok) | |
{ | |
result = await response.json(); | |
if(isGuid(result.ref)){ | |
browserId = result.ref | |
} | |
} | |
} | |
catch(err:any) | |
{ | |
console.log(`getBrowserRef Error retrieving Browser from Sitecore Personalize: ${err}`) | |
} | |
finally { | |
return browserId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment