Skip to main content
Gainsight Inc.

Install Gainsight PX on Salesforce Apps


To install the tracking code in a Salesforce app running in an iframe, you need to use a different initialization function and pass the iframeModeEnabled parameter as false.


When using the script below, update the product key (AP-XXXXXXXXXXXX-2) to the actual key you are using.

// Global function to initialize Gainsight PX
function initializeGainsightPX() {
    if (this.isGainsightPXInitialized) return;
    // Gainsight PX Tag
    (function (n, t, a, e, x) {   
        let i = "aptrinsic"; n[i] = n[i] || function () {
            (n[i].q = n[i].q || []).push(arguments)
        }, n[i].p = e, n[i].c = x;   
        let r = t.createElement("script");
        r.async = !0;
        r.src = a + "?a=" + e;
        let c = t.getElementsByTagName("script")[0];
        c.parentNode.insertBefore(r, c);
    })(window, document, "", "AP-XXXXXXXXXXXX-2",{ "iframeModeEnabled": false }); 
    // End Gainsight PX Tag
    this.isGainsightPXInitialized = true;
initializeGainsightPX();  // Call global init function whenever a new page is loaded    

Limitations in Using LWC Apps 

Following features are not supported while using PX for Salesforce LWC apps:

  • Guide engagements 
  • Guide Mapper
  • Feature Mapper
  • Click tracking events

Note: Dialog engagements and page views are supported once the custom coding is configured. Contact Gainsight PX Support for further assistance.

  • Was this article helpful?