Skip to main content
Gainsight Inc.

Install Gainsight PX in IFrames

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

Gainsight PX support IFrame under multiple setup modes

  • Application that uses multiple IFrames and controls all of them
  • Application is running as a tenant IFrame under a different application

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.

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 as follows:

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?