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

# Heap 連携

> Turnint AI のセッションイベントを Heap に送信する方法

セッションイベントを [Heap](https://www.heap.io) のカスタムイベントとして自動送信します。

## 検出条件

`window.heap` がオブジェクトで、`heap.track` が関数として存在する場合に検出されます。

## 送信方法

```javascript theme={null}
heap.track("turnint_started", { type: "started" });
```

## ヘッドスクリプト設定

ポータルの **ヘッドスクリプト** に以下を貼り付けてください。`YOUR_APP_ID` はご自身のアプリ ID に置き換えてください。

```html theme={null}
<script type="text/javascript">
  window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
  heap.load("YOUR_APP_ID");
</script>
```
