Skip to main content

Smart Push Snippet

Integration

The installation of the Smart Push solution on the customer's site is carried out by integrating a snippet of javascript code within the desired page.

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('STPUSHLoaded', function (e) {
var stPush = e.detail;
stPush.init({
analyticsUA: 'UA-00000000-0',
searchFiltered: false,
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: [],
tags: [],
},
});
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/push.main.js"
></script>

Link to demo : Click here

The integration of the code snippet above is sufficient to allow the partial display of the Push within the page. You must also communicate your domain name to your Smart Tribune contact point so that we allow the product to be displayed completely on your environment.

Please note, the link to push.main.js is a demonstration of the product, the smart-tribune folder in the url will be replaced by the one that will be communicated to you. The url changes completely during the transition from pre-production (public) to production. The complete url is communicated by your Smart Tribune contact point in charge of your account.

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.

Validation environment

caution

This url differs depending on the environment on which the solution is to be installed at the customer site. It is customary to use PUBLIC for pre-production and to use PRODUCTION for production at the customer site. All this information is communicated by Smart Tribune after the development phase.

PRODUCTION script

<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/push.main.js"
></script>

PRE-PRODUCTION script

<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/public/push.main.js"
></script>

Variables list

VariableTypeConditionExampleDescription
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 analytics cookie (possible value: true or false). By disabling this functionality, it will no longer be possible to send information in the analytics provider for your Smart Push. The default value is false.
buildNamestringoptionalbuildName : "design-2"This variable is very usefull if you have a PUSH wich needs color's changing (for example) between a public space and a member space. If necessary for your Smart Tribune product, the value of the variable will be communicated to you after the development phase.
analyticsConnectorstringoptionalanalyticsConnector : "google"It allows to specify the analytics provider you want to use to send Smart Push's statistics (availables connectors : 'google' and 'atinternet'). The default value is 'google'.
analyticsUAstringoptionalanalyticsUA : "UA-XXXXXXXX"It allows the Smart Push to sending into your analytics provider many informations about Smart Push's users. Compatible with Google Analytics V4 ("G-XXXXXXXX") and ATInternet ("siteId").
analyticsConfigurationobjoptionalanalyticsConfiguration : { collectDomain: "example.com" }This configuration variable allows you to send a specific configuration to the analytics provider (required with "atinternet" connector). See this section to know more about supported properties.
searchFilteredbool/objoptionalsearchFiltered : trueThis variable contextualizes the search with the values of the filters parameter. The default value is true so that the search engine returns only results in the chosen context. Please note that the accessible content remains conditioned by the scope of the solution (FAQ, PUSH, etc.). The value false makes all the contents of the knowledge base accessible in the search engine. To contextualize the search on a different selection of the filters variable, it is possible to add an array of character strings (system identifier of the tag) to specify the new search context (searchFiltered : {"tags: ["TAG"]}).
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.
entrypointobjoptionalentrypoint : { type: "question", value: "question-slug" }This configuration variable allows you to display at the loading of Smart Push, a question or the questions of a category. To do it, you have to choose the type ('question' or 'thematic') and insert into 'value' the slug of the specified question or thematic.
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.
info

Slug: This is the identifier in "character string" format of a question and a category. This can be found for categories in Smart Dashboard ('Menu'> 'Knowledge base'> 'Categories' > 'system identifier'). This can be found for questions in url in the FAQ directly (example.com/faq?question=SLUG).

Analytics Configuration

Depending on the connector used, you can specify an optional configuration to the analytics provider by using an object in analyticsConfiguration.

ATInternet Configuration

PropertyTypeDescription
collectDomainstringDomain statistics data collection. You can find this information in your ATInternet dashboard. (Read more)
addEventURLstringAutomatically adds a page_url property to all events, containing the URL of the current page. Possible values: false, withoutQS, true (default).

Google Analytics Configuration

PropertyTypeDescription
transportUrlstringSend data to a server-side container.
firstPartyCollectionboolMust be set to true when transportUrl is specified.

The optional functions

Use the show() function

The show() function will allow you to open the box.

From a...Description
buttonJust call the show() function on your button.
<button onclick="detail.show()">Btn</button>
From a...Description
timerPlace a setTimeout in a <script> tag after initializing Smart Push.
<script type="text/javascript">
window.addEventListener('STPUSHLoaded', function (e) {
var stPush = e.detail;
stPush.init({
analyticsUA: 'UA-00000000-0',
searchFiltered: false,
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: [],
tags: [],
},
});
setTimeout(() => {
stPush.show();
}, 3000);
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/push.main.js"
></script>
From a...Description
scrollPlace a headset after initializing Smart Push.
<script type="text/javascript">
window.addEventListener('STPUSHLoaded', function (e) {
var stPush = e.detail;
stPush.init({
analyticsUA: 'UA-00000000-0',
searchFiltered: false,
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: [],
tags: [],
},
});
window.addEventListener(
'scroll',
function (e) {
stPush.show();
},
false,
);
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/push.main.js"
></script>

If you need to use these functions outside the script (on a button by example), you will need to store stPush inside window which is a global variable :

<script type="text/javascript">
window.addEventListener('STPUSHLoaded', function (e) {
window.stPush = e.detail;
window.stPush.init({
analyticsUA: 'UA-00000000-0',
searchFiltered: false,
kbId: 2,
locale: 'en',
cookieOptin: false,
filters: {
thematics: [],
tags: [],
},
});
});
</script>
<script
type="text/javascript"
async
src="https://assets.app.smart-tribune.com/smart-tribune/PUSH/push.main.js"
></script>

Use the hide() function

The hide() function will allow you to close the box.

From a...Description
buttonJust call the hide() function on your button.
<button onclick="window.stPush.hide()">Btn</button>

Use the off() function

The off() function will allow you to make the box disappear from the page.

From a...Description
buttonJust call the off() function on your button.
<button onclick="window.stPush.off()">Btn</button>

Use the on() function

The on() function will allow you to make the box appear on the page.

From a...Description
boutonJust call the on() function on your button.
<button onclick="window.stPush.on()">Btn</button>

Third-party scripts

caution

In some cases, you may need to authorize third-party domains as we use scripts external to Smart Tribune for some functionality described below.

Polyfill-fastly.io

Polyfill-fastly.io is a service developed by The Financial Times which accepts a request for a set of browser features and returns only the polyfills that are needed by the requesting browser. This is used to ensure compatibility with all browsers up to IE 11.

VersionScript URLDomain to authorize
V3https://polyfill-fastly.io/v3/polyfill.min.jspolyfill-fastly.io

Google Analytics

Google Analytics is an analysis tool developed by Google that measures website traffic and collects essential information about website visitors.

VersionScript URLDomain to authorize
V3https://www.google-analytics.com/analytics.jsgoogle-analytics.com
V4https://www.googletagmanager.com/gtag/jsgoogletagmanager.com

ATInternet

ATInternet is a privately held company that provides web analytics services and consulting for websites, intranet, mobile sites and mobile applications.

VersionScript URLDomain to authorize
V6https://tag.aticdn.net/piano-analytics.jstag.aticdn.net