Skip to main content
Gainsight Inc.

Integrate PX with Product Feature Flag

ATTENTION: Documentation Updates are in Process
We are in the process of updating the screenshots, GIFs, and content to match the latest UX based on the Horizon Experience’s new look and feel. To learn more about the Horizon Experience in Gainsight PX, click here.

This article explains how to integrate PX with feature flag.


Using feature flag is core to every SaaS product and designed to support graduated rollout from beta release (limited availability) to GA (general availability). It is also used for access level control in cases you have different product packaging per subscription.

The recommended way to integrate Gainsight PX with feature flag is via GlobalContext

Passing feature flag using GlobalContext:

var features = {
"dashboardFeatureEnabled": true,
 aptrinsic('set', 'globalContext',features);

Example of integrating PX with LaunchDarkly feature flag system 

/* How to integrate with LaunchDarkly */
(function(n,t,a,e){var i="ldaptrinsic";n[i]=n[i]||function(){
    var r=t.createElement("script");r.async=!0,r.src=a;
    var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)
/* set you LD client side id and pass a user YOUR_CLIENT_SIDE_ID */
var user = {
  "key": "aa0ceb"
setTimeout(function() {
    var ldclient = LDClient.initialize('YOUR_CLIENT_SIDE_ID', user);
/* initializing globalContext */
ldclient.on('ready', function() {
eval( "aptrinsic('set', 'globalContext'," + JSON.stringify(ldclient.allFlags()) +")");
}, 4000);

Using feature flag to trigger in-app guidance using GlobalContext rule: 

New feature guide.png

Measuring feature usage based on enabled features using GlobalContext filtering:

feature flag.png

  • Was this article helpful?