Skip to main content
Gainsight Inc.

Integrate PX with Product Feature Flag

This article explains how to integrate PX with feature flag.

Overview

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,
"superAdminFeatureEnabled":false
};
 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(){
      (n[i].q=n[i].q||[]).push(arguments)},n[i].p=e;
    var r=t.createElement("script");r.async=!0,r.src=a;
    var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)
  })(window,document,"https://unpkg.com/launchdarkly-js-client-sdk@2","");
/* 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?