Code to copy below Jornaya Script :
<input id="leadid_token" name="leadid_token" type="hidden" value="" />
<script>
// starts a loop with interval of 500ms
var loop = setInterval(getToken, 500)
function getToken() {
var leadId = document.getElementById('leadid_token').value;
// check if token has been generated
if (leadId){
console.log(leadId);
document.querySelector('[data-q="leadid_token"]').value = leadId;
document.querySelector('[data-q="leadid_token"]').dispatchEvent(new Event("input"));
clearInterval(loop);
}
}
</script>