Widget methods and functions dictionary

Here's a full list of the variables, functions, and methods available in our Contextual Help Widget 2.0:

Function/Method
Description
Additional notes
References
_ko19.open();
Open the widget
Often used after or with other methods
Open widget to a specific article or category
_ko19.close();
Close the widget
Often used after or with other methods

_ko19.reset();
Reset the widget's displayed article and recommended articles
Puts the widget back into an "empty" state. Can be used to clear out the widget on close or to clear out recommended content before running the _ko19.updateRecommended() method

_ko19.onOpen = function() {}
The widget has been opened
Use this to execute code when the widget is opened
Open widget to specific tab
Using Widget 2.0 on Single Page Applications
Prepopulate Widget 2.0 Contact Form fields
_ko19.onReady = function () {}
The widget is loaded and ready to receive commands
Use this to execute code when the widget is ready
Widget 2.0 JWT authentication
Widget 2.0 OAuth2 authentication
_ko19.onLoad = function() {}
The widget is loaded--generally serves to open the widget as soon as the page loads
Use this to execute code when the widget is loaded rather than opened
Open widget to specific tab
Prepopulate Widget 2.0 Contact Form fields
_ko19.onTabChange = function(changeData) {}
The active tab of the widget has been changed
When onTabChange is triggered, changeData will return the old tab and new tab, for example: { oldTab: "recommended", newTab: "article" }

_ko19.openArticle('article-identifier');
Loads the specified article in the widget
Replace article-identifier with article permalink or ID. Keep in single quotes.
Open widget to a specific article or category
_ko19.openCategory('category-identifier');
Loads the specified category in the widget
Replace category-identifier with category permalink or ID. Keep in single quotes.
Open widget to a specific article or category
_ko19.loadContact();
Load/open the Contact tab
Generally used with onLoad or onOpen
Open widget to specific tab
_ko19.loadKnowledge();
Load/open the Knowledge tab
Generally used with onLoad or onOpen
Open widget to specific tab
_ko19.loadRecommended();
Load/open the Recommended tab
Generally used with onLoad or onOpen
Open widget to specific tab
_ko19.updateRecommended('currentUrl');
Update the page path passed to the widget to a path of your choice.
Replace currentUrl with path to use. Most often used with Single Page Applications, though can be used in any situation where you want to transform the URL when passing it to widget. Best to only call this when a reader has initiated widget opening. May want to combine this with _ko19.reset();
Using Widget 2.0 on Single Page Applications
_ko19.updateContact({name: 'Sample name', email: 'Sample email' });
Prepopulate Contact tab fields when authentication isn't used
Accepts name and email details. Replace Sample name and Sample email with values in single quotes
Prepopulate Widget 2.0 Contact Form fields
_ko19.containerId = "my-custom-div-id";
Specify your own wrapper div to put the widget in
This is a variable rather than a function added to the Widget embed script after the _ko19.base_url. Replace my-custom-div-id. Will not change the width of 370px;
Advanced option: add the widget in your own div wrapper
_ko19.onAuthResp = function(response) {}
When authenticating, the widget will pass the response from the authentication back here.
Useful for debugging purposes if an error occurs in authentication
Widget 2.0 JWT authentication
Widget 2.0 OAuth2 authentication
_ko19.onAuthError = function () {}
When authentication is used, the widget will call this function whenever authorization fails.
This can occur before the reader is logged in, and after the authentication expires. With most workflows, you will want to re-authorize the reader when this event occurs.
Widget 2.0 JWT authentication
Widget 2.0 OAuth2 authentication
_ko19.authenticate();
For use with authentication; pass your token as JSON into the widget's authenticate function
Format should be:{'type': 'jwt|oauth', 'token': token_value}
Widget 2.0 JWT authentication
Widget 2.0 OAuth2 authentication