> ## 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.

# Braze 連携

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

セッションイベントを [Braze](https://www.braze.co.jp) のカスタムイベントとして自動送信します。Braze のキャンペーンやキャンバスのトリガーに活用できます。

## 検出条件

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

## 送信方法

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

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

ポータルの **ヘッドスクリプト** に Braze の Web SDK 初期化スニペットを貼り付けてください。API キーと SDK エンドポイントは Braze のダッシュボードから取得できます。

```html theme={null}
<script type="text/javascript">
  +function(a,p,P,b,y){a.braze={};a.brazeQueue=[];for(var s=["subscribeToContentCardsUpdates","subscribeToFeatureFlagsUpdates","subscribeToInAppMessage","subscribeToSdkAuthenticationFailures","toggleLogging","logCustomEvent","logPurchase","logCardImpressions","logCardClick","logCardDismissal","logContentCardImpressions","logContentCardClick","logContentCardDismissal","logFeatureFlagImpression","requestPushPermission","wipeData","stopWebTracking","resumeWebTracking","destroy","getDeviceId","changeUser","getUser","openSession","requestImmediateDataFlush","requestContentCardsRefresh","getCachedContentCards","getFeatureFlag","getAllFeatureFlags","logFeatureFlagImpression","refreshFeatureFlags"],i=0;i<s.length;i++){for(var m=s[i],k=a.braze,l=m.split("."),j=0;j<l.length-1;j++){k=k[l[j]]}k[l[j]]=(new Function("return function "+m.replace(/\./g,"_")+"(){window.brazeQueue.push(arguments); return true}"))()}window.brazeQueue.push=function(e){window.brazeQueue.push(e);braze._fetchData()};a.braze._fetchData=function(){var t=p.createElement("script");t.type="text/javascript";t.src="https://js.appboycdn.com/web-sdk/5.7/braze.min.js";t.async=1;t.onload=function(){for(var t=window.brazeQueue,i=0;i<t.length;i++){braze[t[i][0]].apply(braze,Array.prototype.slice.call(t[i],1))}};p.head.appendChild(t)}}(window,document);
  braze.initialize("YOUR_API_KEY", {
    baseUrl: "YOUR_SDK_ENDPOINT"
  });
  braze.openSession();
</script>
```
