Skip to main content
Gainsight Inc.

Allow Users to Hide or Dismiss the In-App Hub

This article walks admins through how to give their users a way to hide or dismiss the In-App Hub (formerly Knowledge Center Bot) from within the hub itself, using a custom JavaScript function.

Overview

The In-App Hub does not currently support a native option for users to dismiss the floating launcher. Gainsight PX allows you to work around this by adding a custom JavaScript function to a widget inside the hub. When a user clicks this widget, the hub closes and the launcher is hidden for the remainder of the session.

Business Use Case: Consider that your UX team wants end users to have control over the floating Help launcher, or that users have reported finding it intrusive. Rather than building a custom dismiss button directly into your product UI, you can validate whether users want this control by adding a dismiss option inside the hub itself.

  • This solution hides the In-App Hub for the current session only. The In-App Hub reappears by default when the user starts a new session.
  • This requires access to modify your application code (PX SDK implementation).
  • JavaScript execution inside the In-App Hub is restricted for security reasons. The kcAllowedFuncNames SDK configuration described in this article is required to allow a specific function to run.

Configure the Dismiss Option

To configure a dismiss option, perform the following steps in the prescribed order:

  1. Configure In-App Hub Launch Settings
  2. Add the Function Name to Your PX SDK
  3. Add the JavaScript Function to Your Application
  4. Add the JavaScript Function to the Content Library
  5. Add the Dismiss Option to the In-App Hub

Configure In-App Hub Launch Settings

Before you can control the In-App Hub using API commands, you must enable this behavior in SDK Settings.

  1. Navigate to Administration > SDK Settings.
  2. In the  In-App Hub Launch Options section, select The In-App Hub is controlled using API commands and to qualified users.
  3. Click Save.

Gainsight PX SDK Settings showing In-App Hub launch options to control hub visibility using API commands for qualified users

Add the Function Name to Your PX SDK

Admins need to add the JavaScript function to the product tag to ensure security. Add the following configuration to your PX SDK (product tag), where the function to add is disableKCB:

var config = {
  kcAllowedFuncNames: ["disableKCB"]
};

Add the JavaScript Function to Your Application

Add the following function to your application code, after the PX tag:

function disableKCB() {
  aptrinsic('kcb', 'close');
  setTimeout(function() {
    aptrinsic('kcb', 'hide');
  }, 500);
}

The close command closes the open hub window, and the hide command removes the floating launcher icon. Both are required. Calling hide alone does not close an already-open hub window, and calling close alone does not remove the launcher icon. The delay between the two calls allows the close action to complete before the hide action runs. For more information on these commands, refer to the Work with Knowledge Center Bot API article.

Add the JavaScript Function to the Content Library

The function must be added to the Content Library before it can be used as widget content.

  1. Navigate to In-App Hub > Content Library.
  2. Click Add Content and select JavaScript Function.
  3. Enter the JavaScript Function Name: disableKCB.
  4. Click Add.

Gainsight PX Content Library Add Function dialog showing fields to configure a JavaScript function for dismissing the In-App Hub

Enter the function name only, and do not include parentheses.

  • Correct: disableKCB
  • Incorrect: disableKCB()

For more information on adding content to the Content Library, refer to the Manage In-App Hub Content using Content Library article.

Add the Dismiss Option to the In-App Hub

With the function available in the Content Library, you can now add it to the hub as a widget end users can click.

  1. From the main menu, click In-App Hub.
  2. Click Add Widget.
  3. Select Content Group.
  4. Select a layout, such as Card Layout.
  5. Enter a title, such as Hide Help Center.
  6. Add the JavaScript Function created previously as the content for this widget.
  7. Click Save.

Gainsight PX In-App Hub Content Group showing a custom function that lets end users dismiss or hide the In-App Hub