Skip to main content
Gainsight Inc.

Install Gainsight PX in IFrames

This article explains the procedure to install Gainsight PX in iFrames.

Overview

Gainsight PX support IFrame under the following setup modes:

  • Application that uses multiple IFrames and controls all of them ({ "iframeModeEnabled": true })
  • Application is running as a tenant IFrame under a different application  ({ "iframeModeEnabled": false })

Application with Multiple IFrames

In case your application is using multiple iFrames you should install the standard tracking tag in every iFrame. The tracking tag will detect the iFrame mode and will automatically adapt the tracking strategy. In this scenario, the iframeModeEnabled flag is defaulted to true and hence not required.

Application is Running as a Tenant IFrame Under a Different Application

In some cases your application is running as a tenant iframe under a different top level application which you have no control and cannot install the tag there (i.e. an Iframe app in Salesforce.com). In this type of scenarios you will need to install a modified version of the tag, with iframeModeEnabled flag set to false as follows (highlighted in green):

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?