Embed With Variables

Initializing an Embed with variables

The BankingBridge Embed is typically used to feature a particular Loan Officer. By default, the owner/creator of the Embed is used as the Loan Officer to be featured.

Sometimes, it’s more practical to reuse a single Embed for several Loan Officers. We support that by allowing the webpage to pass variables to the Embed (for example, NMLS).

The Embed code should be placed into the body of the page as HTML that supports JavaScript.

🚧

Note:

In the following examples, do not change the words “widget” or “boomtown” in the code. You do not need to include # or other special characters.

<div id='bb-c24cd'>
  <script>
    window.BB || document.write("<script src='https://cdn.bankingbridge.com/assets/external/index.js' type='text/javascript' charset='utf-8' defer=''><\/script>")
  </script>
  <script>
    window.addEventListener('DOMContentLoaded', function() {BB.init('3208337722', document.getElementById('bb-c24cd'),{type:'widget'});})
  </script>
</div>

To feature a specific loan officer, you can pass an NMLS to BB.init(), like in the following example:

<div id='bb-c24cd'>
  <script>
    window.BB || document.write("<script src='https://cdn.bankingbridge.com/assets/external/index.js' type='text/javascript' charset='utf-8' defer=''><\/script>")
  </script>
  <script>
    window.addEventListener('DOMContentLoaded', function() {BB.init('3208337722', document.getElementById('bb-c24cd'),{type:'widget',nmls:'<NMLS_VALUE>'} );})
  </script>
</div>

To fully take advantage of the variable passing feature, the page should dynamically place the variable into the Embed code.

In the following examples, we use PHP and JavaScript to place the variable:

<?php 
$nmls="12345678"; 
?> 

<div id='bb-c24cd'>
  <script>
    window.BB || document.write("<script src='https://cdn.bankingbridge.com/assets/external/index.js' type='text/javascript' charset='utf-8' defer=''><\/script>")
  </script>
  <script>
    window.addEventListener('DOMConte ntLoaded', function() {BB.init('3208337722', document.getElementById('bb-c24cd'),{type:'widget',nmls:'<?= $nmls; ?>'});})
  </script>
</div>
<script>
  var nmls="12345678";
</script>

<div id='bb-c24cd'>
  <script>
    window.BB || document.write("<script src='https://cdn.bankingbridge.com/assets/external/index.js' type='text/javascript' charset='utf-8' defer=''><\/script>")
  </script>
  <script>
    window.addEventListener('DOMConte ntLoaded', function() {BB.init('3208337722', document.getElementById('bb-c24cd'),{type:'widget',nmls:nmls});})
  </script>
</div>