Events
Track any events provided by the Frontnow Advisor to enhance your user experience or integrate with your own event tracking systems.
Google Analytics Integration
If your site already integrates with Google Analytics, all of the advisor events will be automatically forwarded with the prefix "frontnow:[eventname]"
Examples: frontnow:open or frontnow:message
ready
ready
This event gets triggered when the Frontnow Advisor is initialized.
advisor.on('ready', () => {
console.log('Advisor is ready!');
});
open
open
This event gets triggered when the Frontnow Advisor is opened.
advisor.on('open', () => {
console.log('Advisor is open!');
});
close
close
This event gets triggered when the Frontnow Advisor is closed.
advisor.on('close', () => {
console.log('Advisor is closed!');
});
message
message
This event gets triggered when a message is received.
advisor.on('message', (data) => {
console.log('Received message:', data);
});
/**
* @typedef {Object} MessageEventData
* @property {string} value - The content of the message.
*/
recommended-question
recommended-question
This event gets triggered when a recommended question is clicked.
advisor.on('recommended-question', (data) => {
console.log('Recommended question:', data);
});
/**
* @typedef {Object} RecommendedQuestionEventData
* @property {string} value - The prompt text of the recommended question.
*/
discovery-topic
discovery-topic
This event gets triggered when a discovery topic is clicked.
advisor.on('discovery-topic', (data) => {
console.log('Discovery topic:', data);
});
/**
* @typedef {Object} DiscoveryTopicEventData
* @property {string} topic - The identifier of the discovery topic.
* @property {string} title - The title of the discovery topic.
* @property {string} value - The prompt text for the discovery topic.
*/
document-click
document-click
This event gets triggered when a document is clicked.
advisor.on('document-click', (data) => {
console.log('Document clicked:', data);
});
/**
* @typedef {Object} DocumentClickEventData
* @property {string} title - The title of the clicked document.
* @property {string} url - The URL of the clicked document.
*/
follow-up-click
follow-up-click
This event gets triggered when a follow-up question is clicked.
advisor.on('follow-up-click', (data) => {
console.log('Follow-up question clicked:', data);
});
/**
* @typedef {Object} FollowUpClickEventData
* @property {string} question - The follow-up question.
* @property {string} headline - The headline associated with the follow-up question.
* @property {string} prompt - The prompt text for the follow-up question.
*/
Last updated
Was this helpful?