Skip to main content
Gainsight Inc.

Install Gainsight PX on Salesforce apps

Installing the tracking code in a Salesforce app running in an iframe requires a different initialization function and passing the iframeModeEnabled parameter as false.

When using the script below - please 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, "https://web-sdk.aptrinsic.com/api/aptrinsic.js", "AP-XXXXXXXXXXXX-2",{ "iframeModeEnabled": false }); 
    // End Gainsight PX Tag
    this.isGainsightPXInitialized = true;
}
initializeGainsightPX();  // Call global init function whenever a new page is loaded    
  • Was this article helpful?