Smart Form - Input mode
Integration on an input field
HTML
Add in your HTML code a container with an identifier which will display the widget at the location of your choice on the <div id="containerId_OF_YOUR_CHOICE"></div>
.
On your input field, remember to specify an identifier so that you can specify it in the JS code <input id="inputId_OF_YOUR_CHOICE"/>
.
<input id="inputId_OF_YOUR_CHOICE" />
<div id="containerId_OF_YOUR_CHOICE"></div>
JS
Integrate the Javascript snippet just before closing the </body>
tag. The Smart Tribune script must be loaded as far downstream as possible in the script loading chain in order to avoid possible conflicts with the scripts present on the client page.
<script type="text/javascript">
window.addEventListener('STContactFormInputLoaded', function (e) {
e.detail.init({
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: [],
tags: [],
},
labels: {
title: {
en: 'Suggestions',
},
openOnFaq: {
en: 'Open the knowledge base',
},
goToFaqLink: {
en: 'Go to the knowledge base',
},
},
limit: 5,
faqUrl: 'https://example.com/faq',
openInNewTab: true,
inputId: 'my-input',
containerId: 'st-contact-form-input-container',
});
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/ContactFormInput/contactforminput.main.js"
></script>
Link to demo : Click here
info
The domains calling on the specified knowledge base must be declared beforehand directly in the knowledge base configuration in Smart Dashboard by your Account Manager.
Variables list
Variable | Type | Condition | Example | Description |
---|---|---|---|---|
kbId | int | required | kbId: 2 | Variable specific to each customer, it corresponds to the identifier (system identifier) of the knowledge base to be used. This is available in Smart Dashboard, the content administration interface. The knowledge base already integrating test content is identified by the value: 2. You can find your kbId on the Dashboard home page in the "Select a knowledge base" then "system identifier" box. |
locale | string | required | locale: "en" | It allows the customer to specify in which language the solution should be displayed. This only applies to multilingual knowledge bases. |
cookieOptin | bool | required | cookieOptin: false | It allows you to prevent or not the activation of the Google Analytics cookie (possible value: true or false). By disabling this functionality, it will no longer be possible to send information in Google Analytics for your contact form widget. The default value is false . |
customVariables | obj | optional | customVariables: { brand: "Smart Tribune" } | This variable is used to replace the value of a custom variable created in the response content via Smart Dashboard. Note: We expect here a string that can contain HTML tags (span, a, b, u, i, br, img) with its attributes (id, class, style, name, title, target, href, rel, src, alt). |
filters | obj | optional | filters: { thematics: [], tags: [], tagsOr: [] } | This configuration variable allows you to specify the contextualization to apply. It is possible to define the filtering using the thematics system identifier or tags. The operator used is AND in the case of multiple values within the same filter or between filters. If needed, tags can be replaced by tagsOr to use operator OR between tags. Note : These objects contain an array of strings. |
labels | obj | optional | labels: { title: {}, emptyMessage: {}, openOnFaq: {}, goToFaqLink: {} } | This variable allows you to overload the widget strings with those of your choice. We advise you to use the example snippet above to add your own texts. |
limit | int | optional | limit: 5 | Limit on the number of elements to display (max: 25). |
faqUrl | string | optional | faqUrl: "https://example.com/faq" | This redirects users to the FAQ. |
openInNewTab | bool | optional | openInNewTab: true | Open the suggestion links in a new tab. |
inputId | string | optional | inputId: "my-input" | This is the identifier of the form field on which the search must be applied. |
containerId | string | optional | containerId: "st-contact-form-input-container" | This is the identifier of the container that will display the widget. |
customResponses | arr | optional | customResponses: ["tag"] | This variable allows you to specify the customized response contextualization to apply by using the tag system identifier. Note : This variable is an array of string. |
searchSettings | obj | optional | searchSettings: { strictness: "strict" } | This configuration variable contains all the settings to configure your search engine. See this section to know more about supported properties. |
Search Settings
Variable | Type | Condition | Example | Description |
---|---|---|---|---|
strictness | string | optional | strictness: "strict" | This variable allows you to control the search engine sensitivity. By adjusting this parameter, you can change the threshold for search results to be either strict or more lenient, depending on your needs. strict : The search will return results that closely match the search criteria, filtering out less relevant results. This is useful when precise results are necessary. normal (default) : The search will be more lenient, returning a broader range of results that may include more variations and partial matches. This can be helpful when a more comprehensive set of results is preferred. |