Skip to main content
Gainsight Inc.

Integrate PX with Product Feature Flag

This article explains how to integrate Gainsight PX with feature flag.


Using feature flag is core to every SaaS product. It is designed to support graduated rollout from beta release (limited availability) to GA (general availability). Feature flag helps you configure access level controls in case you have different product packaging per subscription.

Gainsight recommends integration of PX with feature flag using GlobalContext. Following code block illustrates the logic of passing feature flag using GlobalContext:

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

Example of integrating Gainsight 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);

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


Measure feature usage based on the active features using GlobalContext filtering:


  • Was this article helpful?