Skip to main content

Smart Context Snippet


The contextualized FAQ widget allows you to add a block on the page of your choice, in order to dynamically retrieve the questions / answers present in your knowledge base, filtered or not based on one or more criteria.


The installation of the solution is done via the integration of the javascript code snippet before the closing tag </body> on the page or pages where it should be displayed.


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>. This identifier must be specified in the containerId option.

<div id="containerId_OF_YOUR_CHOICE"></div>


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('STFAQContextLoaded', function (e) {
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: ['category-1'],
tags: ['tag-1'],
labels: {
title: {
en: 'Questions pertinentes',
emptyMessage: {
en: 'Aucune question',
openOnFaq: {
en: 'Ouvrir sur la FAQ',
goToFaqLink: {
en: 'Voir la FAQ',
limit: 5,
faqUrl: '',
openInNewTab: true,
containerId: 'st-faq-context',
singleQuestionOpen: false,

Link to demo : Click here


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

kbIdintrequiredkbId : 2Variable 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.
localestringrequiredlocale : "en"It allows the customer to specify in which language the solution should be displayed. This only applies to multilingual knowledge bases.
cookieOptinboolrequiredcookieOptin : falseIt 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 widget. The default value is false.
customVariablesobjoptionalcustomVariables : { 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).
filtersobjoptionalfilters : { thematics:[], tags:[] }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.
labelsobjoptionallabels : { title:{}, emptyMessage:{}, openOnFaq:{}, goToFaqLink:{} }CThis 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.
limitintoptionallimit: 5Limit on the number of elements to display (max: 25).
faqUrlstringoptionalfaqUrl: ""This redirects users to your FAQ.
openInNewTabbooloptionalopenInNewTab: trueAllows you to load the FAQ in a new tab.
containerIdstringoptionalcontainerId: "st-faq-context"This is the identifier of the container that will receive the content of your contextualized FAQ widget.
singleQuestionOpenbooloptionalsingleQuestionOpen: falseAllows you to hide the content of the previous open question when you open another one. (default: false)
customResponsesarroptionalcustomResponses : [ "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.