> For the complete documentation index, see [llms.txt](https://app.developers.karte.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://app.developers.karte.io/ios-sdk-appendix/att-tracking.md).

# \[iOS]App Tracking Transparency(ATT)の許諾情報の連携

KARTE SDKによるApp Tracking Transparency(ATT)の許諾情報の連携を有効にしたい場合は、本記事を参考に実装をしてください。

## 実装

ATTの許諾リクエストのコールバックの結果に対して以下の処理を追加することでSDK内部よりイベントが送信されます。

{% code overflow="wrap" %}

```swift
import KarteCore
import AppTrackingTransparency

ATTrackingManager.requestTrackingAuthorization(completionHandler: { status in
    // こちらの処理を追加                                                  
    KarteApp.sendATTStatus(attStatus: status)
})
```

{% endcode %}

管理画面上で`att_status_updated`イベントが送信されており、`att_status`フィールドに値が含まれていることが確認できれば、正しく実装されております。詳細な確認方法については、[サポートサイト](https://support.karte.io/post/5oFDSCP49ybkXaOwMCWkHC) をご覧ください。

## 細かいATT許諾状況の取得

より厳密にATTの許諾状況を管理したい場合、アプリの起動、再開のタイミングでATTの許諾状況を随時送信することができます。

{% code overflow="wrap" %}

```swift
import KarteCore
import AppTrackingTransparency
import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        ...
        // 起動時にATTの許諾状況を送信する
        KarteApp.sendATTStatus(attStatus: ATTrackingManager.trackingAuthorizationStatus)
        return true
    }
    ...
}
```

{% endcode %}

{% hint style="info" %}
**イベント数節約のために**

上述の実装をすると、アプリ起動時に毎回`att_status_updated`イベントが発火されるため、イベント数が増えてしまいます。

もしイベント数の節約したい場合は、userDefaults内にATT許諾状況を保存しておき、差分があった場合のみ `KarteApp.sendATTStatus(attStatus: ATTrackingManager.trackingAuthorizationStatus)` を呼び出すようにしてください。
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://app.developers.karte.io/ios-sdk-appendix/att-tracking.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
