--- title: "Integrate PX with Product Feature Flag" slug: "integrate-px-with-product-feature-flag" updated: 2026-11-23T12:30:19Z published: 2026-11-23T12:30:19Z canonical: "support.gainsight.com/integrate-px-with-product-feature-flag" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.gainsight.com/llms.txt > Use this file to discover all available pages before exploring further. # Integrate PX with Product Feature Flag This article explains how to integrate Gainsight PX with feature flag. ## Overview 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: ```plaintext var features = { "dashboardFeatureEnabled": true, "superAdminFeatureEnabled":false }; aptrinsic('set', 'globalContext',features); ``` Example of integrating Gainsight PX with [*LaunchDarkly*](https://launchdarkly.com) feature flag system: ```plaintext /* 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); ``` Use the feature flag to trigger in-app guidance using GlobalContext rule: ![feature_flag_global_context_rule.PNG](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/feature_flag_global_context_rule.jpeg?sv=2026-02-06&spr=https&st=2026-11-24T18%3A26%3A59Z&se=2026-11-24T19%3A26%3A59Z&sr=b&sp=r&sig=RMIxTaE%2BqrED8winNA4hO1uhFQDqnugh4z4I6d0DABc%3D) Measure feature usage based on the active features using GlobalContext filtering: ![feature_usage_global_context.PNG](https://cdn.us.document360.io/8e136619-829c-49c5-afb1-72de86f13288/Images/Documentation/feature_usage_global_context.jpeg?sv=2026-02-06&spr=https&st=2026-11-24T18%3A26%3A59Z&se=2026-11-24T19%3A26%3A59Z&sr=b&sp=r&sig=HBVUGz7zcVPXBYC3DwR4xQP1cSi01khoSjhqloM6Bbc%3D)