Skip to content

Direct JavaScript Installation

Install Leadbehavior on your website without Google Tag Manager. Use this method if you manage your scripts directly or use a tag management system other than GTM.

Prefer GTM?

If you use Google Tag Manager, the Community Template is the easiest way to install Leadbehavior.

Prerequisites

The Bootstrap Script

The core Leadbehavior script sets up the window.leadbehavior object, loads the scoring library, and calls verify() with your lead configuration.

javascript
window.leadbehavior = window.leadbehavior || {
  queue: [],
  verify: function (options, callback) {
    window.leadbehavior.queue.push([options, callback])
  },
  accountId: 'YOUR_ACCOUNT_ID',
}
if (!document.querySelector('[src*="static.leadbehavior.com/verify.js"]')) {
  var s = document.createElement('script')
  s.setAttribute('src', 'https://static.leadbehavior.com/verify.js')
  s.setAttribute('crossorigin', true)
  document.body.appendChild(s)
}

window.leadbehavior.verify(
  {
    'leadId': 'YOUR_LEAD_ID',
    'orderId': 'YOUR_ORDER_ID', // A unique identifier for each conversion
  },
  function (score) {
    console.log('leadbehavior score', score)
  }
)

Replace YOUR_ACCOUNT_ID, YOUR_LEAD_ID, and YOUR_ORDER_ID with your actual values.

Pre-filled Scripts

Each lead's detail page at app.leadbehavior.com/leads includes pre-filled script examples with your Account ID and Lead ID already populated. Click on a lead to view them.

How It Works

  1. window.leadbehavior — Creates a global object with a queue pattern. If verify() is called before the script loads, calls are queued and replayed once the library is ready.
  2. verify.js — The Leadbehavior scoring library loaded from static.leadbehavior.com. It collects a reCAPTCHA Enterprise token, browser fingerprint, click IDs (gclid, fbclid, dclid), and UTM parameters.
  3. verify(options, callback) — Sends the collected data to Leadbehavior for scoring. The callback receives the score result.

Installation Methods

Form Submission Listener

Trigger Leadbehavior when a specific form is submitted:

javascript
var leadForm = document.getElementById('lead-form') // Replace with your form's ID
leadForm.addEventListener('submit', function () {
  // Paste the bootstrap script here
})

Click Listener

Trigger Leadbehavior when a button is clicked:

javascript
var leadButton = document.getElementById('lead-button') // Replace with your button's ID
leadButton.addEventListener('click', function () {
  // Paste the bootstrap script here
})

GTM Custom HTML

If you use GTM but want more control than the template provides, paste the bootstrap script into a Custom HTML tag:

html
<script>
  (function () {
    // Paste the bootstrap script here
  })()
</script>

Set an appropriate trigger (form submission, custom event, etc.) in GTM.

The Order ID

The orderId parameter is a unique identifier for each conversion event.

  • Google Ads requires an Order ID to match conversion adjustments to the original conversion
  • Use a value that's unique per submission (e.g., a transaction ID, form submission ID, or generated UUID)
  • Do not use GTM's Random Number variable — it generates a new value each time it's evaluated

Important

The Order ID you pass to Leadbehavior must match the Order ID sent to Google Ads for the same conversion. This is how Google Ads matches the adjustment to the original conversion event.

The Verify Callback

The verify() callback function receives the scoring result:

javascript
window.leadbehavior.verify(
  {
    'leadId': 'YOUR_LEAD_ID',
    'orderId': 'YOUR_ORDER_ID',
  },
  function (score) {
    // score contains the result from Leadbehavior
    console.log('leadbehavior score', score)
  }
)

You can use the callback for custom logic — such as logging, analytics, or conditional behavior based on the score.

Troubleshooting

Script not loading

  • Verify https://static.leadbehavior.com/verify.js is not blocked by ad blockers or Content Security Policy
  • Check the browser console for errors
  • Ensure the script tag is being injected into the DOM

Score not returning in callback

  • Verify your Account ID and Lead ID are correct
  • Check that the lead exists and is not archived in your Leadbehavior account
  • Review the browser console for error messages

Conversion adjustments not appearing in Google Ads

  • Ensure the Order ID matches between your Google Ads conversion tag and the Leadbehavior tag
  • Allow up to 24 hours — conversion adjustments are sent in a daily batch

Next Steps