メインコンテンツへスキップ

概要

UMP(User Messaging Platform)SDKは、GDPR(一般データ保護規則)およびCCPA(カリフォルニア消費者プライバシー法)準拠のために、パーソナライズド広告に対するユーザーの同意を管理します。
UMP連携にはadrop-ads-backfillモジュールが必要です。はじめにのインストールガイドを先に完了してください。

基本的な使い方

Adrop初期化後にConsent Managerを使用してユーザーの同意を要求します。
import AdropAds

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Adrop.initialize()の後に呼び出し
        Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
            if let error = result.error {
                print("同意エラー: \(error)")
            }
        }
    }
}

同意結果

requestConsentInfoUpdateのコールバックは、以下のプロパティを持つAdropConsentResultオブジェクトを返します:
プロパティ説明
statusAdropConsentStatus現在の同意ステータス
canRequestAdsBool広告リクエストが可能かどうか
canShowPersonalizedAdsBoolパーソナライズド広告の表示が可能かどうか
errorError?リクエスト失敗時のエラー
Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
    print("Status: \(result.status)")
    print("Can request ads: \(result.canRequestAds)")
    print("Can show personalized ads: \(result.canShowPersonalizedAds)")

    if let error = result.error {
        print("Error: \(error)")
    }
}

同意ステータス

Consent Managerは次のステータスのいずれかを返します:
ステータス説明
unknown同意ステータスがまだ決定されていない
required同意が必要(ポップアップが表示される)
notRequired同意は不要(非GDPR地域)
obtainedすでに同意を取得済み

デバッグ設定(テストモード)

開発中にGDPR/CCPA同意フローをテストしてください:
import AdropAds

#if DEBUG
// 同意リクエスト前にデバッグ地域を設定
Adrop.consentManager?.setDebugSettings(
    testDeviceIdentifiers: ["YOUR_DEVICE_IDENTIFIER"],  // Xcodeコンソールで確認
    geography: .EEA  // GDPRテスト
)

// テスト用に同意状態をリセット
Adrop.consentManager?.reset()
#endif

デバッグ地域

地域説明
disabled実際のデバイス位置を使用
EEAGDPRテスト(欧州経済領域)
regulatedUSStateCCPAテスト(カリフォルニアなど)
other非規制地域テスト
デバッグ設定は開発中のみ使用してください。本番リリース前に削除または無効化してください。

追加メソッド

メソッド戻り値説明
getConsentStatus()AdropConsentStatus現在の同意状態を返します
canRequestAds()Bool同意状態に基づいて広告リクエスト可能かどうかを返します
reset()Void同意情報をリセットします
// 同意状態を個別に確認
if let status = Adrop.consentManager?.getConsentStatus() {
    switch status {
    case .obtained:
        print("同意完了")
    case .required:
        print("同意必要")
    case .notRequired:
        print("同意不要")
    case .unknown:
        print("同意状態不明")
    }
}

// 広告リクエスト可能か確認
if Adrop.consentManager?.canRequestAds() == true {
    // 広告をロード
}

// 同意情報をリセット(テスト用)
Adrop.consentManager?.reset()

ベストプラクティス

早期リクエスト

SDK初期化直後、アプリライフサイクルの早い段階で同意を要求してください。

エラー処理

同意エラーを適切に処理し、フォールバック動作を提供してください。

全シナリオテスト

リリース前にデバッグ設定を使用してすべての同意シナリオをテストしてください。

ユーザー選択の尊重

同意を得たり拒否された後は、ユーザーの選択を尊重し、繰り返し要求しないでください。

関連ドキュメント

ターゲティング

ユーザーおよびコンテキストターゲティング設定

はじめに

SDKインストールおよび設定ガイド

リファレンス

クラス、デリゲート、エラーコード