> ## Documentation Index
> Fetch the complete documentation index at: https://docs.userpilot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations Interfaces

> Configure Userpilot SDK to forward events to external analytics tools like Mixpanel, Amplitude, Google Analytics, Segment, and more.

Userpilot automatically detects and uses external analytics tools declared under:

```javascript theme={null}
window.userpilotSettings.integrations_interfaces
```

This object maps integration keys to their corresponding SDK instances or function references. Each key should point to the initialized SDK object, allowing Userpilot to track events through your existing analytics setup.

## Example

```javascript theme={null}
window.userpilotSettings = {
  integrations_interfaces: {
    mixpanel: Mixpanel,
    amplitude: amplitudeInstance,
    kissmetrics: _kmq,
    heap: heap,
    ga: gtag, // or window.ga / window._gaq
    intercom: Intercom,
    gtm: window.dataLayer,
    segment: analytics
  }
};
```

## Integration Keys

### **mixpanel**

```javascript theme={null}
import mixpanel from 'mixpanel-browser';
mixpanel.init('YOUR_TOKEN');

Userpilot.initialize(APP_TOKEN, {
  integrations_interfaces: {
    mixpanel
  }
});
```

### **amplitude**

```javascript theme={null}
import amplitude from 'amplitude-js';
amplitude.getInstance().init('YOUR_API_KEY');

Userpilot.initialize(APP_TOKEN, {
  integrations_interfaces: {
    amplitude: amplitude.getInstance()
  }
});
```

### **kissmetrics**

```javascript theme={null}
window._kmq = window._kmq || [];
(function() {
  const _kmk = document.createElement('script');
  _kmk.async = true;
  _kmk.src = 'https://i.kissmetrics.io/i.js';
  const s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(_kmk, s);
})();

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    kissmetrics: _kmq
  }
};
```

### **heap**

```javascript theme={null}
window.heap = window.heap || [];
heap.load('YOUR_APP_ID');

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    heap
  }
};
```

### **ga / gtag / \_gaq**

```javascript theme={null}
// For GA4
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    ga: gtag
  }
};
```

### **intercom**

```javascript theme={null}
window.Intercom('boot', { app_id: 'YOUR_APP_ID' });

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    intercom: Intercom
  }
};
```

***

### **gtm**

```javascript theme={null}
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: 'userpilot_loaded' });

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    gtm: window.dataLayer
  }
};
```

***

### **segment**

```javascript theme={null}
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t,e){var n=document.createElement("script");n.type="text/javascript";n.async=!0;n.src="https://cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(n,a);analytics._loadOptions=e};analytics._writeKey="YOUR_WRITE_KEY";analytics.load("YOUR_WRITE_KEY");analytics.page();}}

window.userpilotSettings = {
  token: APP_TOKEN
  integrations_interfaces: {
    segment: analytics
  }
};
```
