Embedding “ChatBar” AI Search
Author: Brod Justice
Published Date: December 12, 2025
Author: Brod Justice
Published Date: December 12, 2025
The simplest version of the AI Search service is achieved with the short code snippet shown below. Replace <MY TOKEN> with your website specific token.
<script src='https://scripts.chatbar-ai.com/cb-ai-search.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', async function() {
_bl_ai_search.init('<MY TOKEN>');
});
</script>
Note: The code will load javascript and css from the Search AI server at scripts.chatbar-ai.com. So if you operate a strict CSP then you might need to adjust the CSP to allow this.
If you have selected a style from the examples provided by Business Landing or ChatBar AI Pte then you will need to provide an HTML element that the AI Search will be attached to. In the example below the HTML element has an id of auto_ai_search_bot. Replace <MY TOKEN> with your website specific token.
<script src='https://scripts.chatbar-ai.com/cb-ai-search.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', async function() {
var ai_element = document.getElementById('auto_ai_search_bot');
_bl_ai_search.init('<MY TOKEN>', ai_element);
});
</script>
Exposing your website specific token has little to no security implications as it only allows queries related to your own website.
For more flexibility you may call _bl_ai_search.init() and supply your own callbacks to modify the javascript actions to suit your own needs. The bl_ai_search javascript provides 4 callbacks:
The search results have the following JSON format:
{
"title": "META Title of page",
"description": "META Description of page",
"image": "URL of the meta image",
"source": "URL of the page"
}
Supply your callback functions in the following manner:
<script src='https://business-landing.com/scripts/bl_ai_search.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', async function() {
var ai_element = document.getElementById('auto_ai_search_bot');
_bl_ai_search.init(
'<MY TOKEN>',
ai_element,
{
callback: AiAnswerCallback,
configCallback: configCallback,
searchResultsCallback: searchResultsCallback,
processingCallback: processingCallback
}
);
});
</script> © 2026. All rights reserved.