Introduction
In this article, you’ll learn how to set up Jornaya-LeadId inside LeadsHook.
Learn more about meeting your TCPA-compliant lead generation requirements using Jornaya-LeadsId here:
https://www.jornaya.com/the-data/leadid/
Step-by-Step Instructions:
Step 1: First copy/paste your leadID script into the global level or decision tree level scripts section.

Note: If you place the script at the global level, make sure to enable it on the decision tree level.
Step 2: Create a custom field called “leadid_token” ( Type: text, visible: no, required: no )

Step 3: Version 1 and Version 2 use different script libraries. Version 2 is more restrictive with scripts, so Version 2 has a different setup from Version 1.
For Version 1 Decision Trees:
Step 1: Copy/paste this script into the node level and fire it upon “Enter”.
<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){
// assign the generated token to LH custom field
DT.setField('leadid_token', leadId);
// logs the token to the console
console.log(leadId);
// stops the loop
clearInterval(loop);
}
}
</script>


For Version 2 Decision Trees:
Step 1: Add the hidden input to Appearance > Header & Footer > Display Footer > Content Above Footer.
<input id="leadid_token" name="leadid_token" type="hidden" value="" />

Step 2: Add the rest of the script into the node level:
Important: DT.setField function cannot be used on the last node for V2 DTs.
<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){
// assign the generated token to LH custom field
DT.setField('leadid_token', leadId);
// logs the token to the console
console.log(leadId);
// stops the loop
clearInterval(loop);
}
}
</script>

Now test with the browser console. You should see the leadID populate.

The leadID is saved in the {leadid_token} custom field. You can use it when mapping your fields, webhooks, email, etc.