Google の EU ユーザーの同意ポリシーに基づき、広告主様は英国だけでなく欧州経済領域(EEA)のユーザーに対しても特定の開示を行い、法律で義務付けられている場合に Cookie またはその他のローカル ストレージを使用すること、および広告を配信するための個人データ(AdID など)を使用することについてユーザーの同意を得る必要があります。このポリシーには、EU の e プライバシー指令と一般データ保護規則(GDPR)の要件が反映されています。
Google は、パブリッシャーがこのポリシーで定められた義務を遂行できるようサポートするため、User Messaging Platform(UMP)SDK を提供しています。UMP SDK が更新され、最新の IAB 標準に対応するようになりました。これらの設定はすべて、[プライバシーとメッセージ] で簡単に処理できます。 AdMob
Prerequisites
- スタートガイドを完了している
- GDPR 関連の要件に取り組んでいる場合は、以下をお読みください。 IAB の要件が EU ユーザー向け同意メッセージに与える影響
メッセージ タイプを作成する
利用可能なユーザー メッセージの種類のいずれかを使用してユーザー メッセージを作成します。 AdMob アカウントの [プライバシーとメッセージ] タブで設定します。UMP SDK は、プロジェクトに設定されたアプリケーション ID から作成されたユーザー メッセージの表示を試みます。 AdMob アプリにメッセージが構成されていない場合、SDK はエラーを返します。
詳しくは、 プライバシーとメッセージについてをご覧ください。
同意情報のリクエスト
Update()
を使用して、アプリの起動ごとにユーザーの同意情報の更新をリクエストする必要があります。これにより、ユーザーがまだ同意していない場合、または同意の有効期限が切れている場合に、同意を提示する必要があるかどうかが判断されます。
アプリ起動時のステータスを確認する方法の例を次に示します。
void Start()
{
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
void OnConsentInfoUpdated(FormError consentError)
{
if (consentError != null)
{
// Handle the error.
UnityEngine.Debug.LogError(consentError);
return;
}
// If the error is null, the consent information state was updated.
// You are now ready to check if a form is available.
}
必要に応じて同意フォームを読み込んで表示する
最新の同意ステータスを取得したら、ConsentForm
クラスのLoadAndShowConsentFormIfRequired()
を呼び出して同意フォームを読み込みます。同意ステータスが必須の場合、SDK はフォームを読み込み、からすぐに表示します。 Action<FormError>
callbackは、フォームが閉じられた後に呼び出されます。同意が不要な場合は、すぐに Action<FormError>
callbackが呼び出されます。
void Start()
{
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
void OnConsentInfoUpdated(FormError consentError)
{
if (consentError != null)
{
// Handle the error.
UnityEngine.Debug.LogError(consentError);
return;
}
// If the error is null, the consent information state was updated.
// You are now ready to check if a form is available.
ConsentForm.LoadAndShowConsentFormIfRequired((FormError formError) =>
{
if (formError != null)
{
// Consent gathering failed.
UnityEngine.Debug.LogError(consentError);
return;
}
// Consent has been gathered.
});
}
ユーザーが選択を行うかフォームを拒否した後になんらかのアクションを行う必要がある場合は、そのロジックをフォームの Action<FormError>
callbackに配置します。
広告をリクエスト
アプリで広告をリクエストする前に、 を使用してユーザーから同意を得ているかどうかを確認してください。同意を収集する際は、次の 2 つの点を確認します。
- 現在のセッションで同意が取得された後。
-
Update()
を呼び出した直後。前回のセッションで同意を得ている可能性があります。アプリの起動後すぐに広告の読み込みを開始できるように、遅延に関するベスト プラクティスとして、コールバックの完了を待たないことをおすすめします。
同意取得の処理中にエラーが発生した場合でも、広告のリクエストを行う必要があります。UMP SDK は前のセッションの同意ステータスを使用します。
void Start()
{
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
void OnConsentInfoUpdated(FormError consentError)
{
if (consentError != null)
{
// Handle the error.
UnityEngine.Debug.LogError(consentError);
return;
}
// If the error is null, the consent information state was updated.
// You are now ready to check if a form is available.
ConsentForm.LoadAndShowConsentFormIfRequired((FormError formError) =>
{
if (formError != null)
{
// Consent gathering failed.
UnityEngine.Debug.LogError(consentError);
return;
}
// Consent has been gathered.
if (ConsentInformation.CanRequestAds())
{
MobileAds.Initialize((InitializationStatus initstatus) =>
{
// TODO: Request an ad.
});
}
});
}
テスト
開発中にアプリとの統合をテストする場合は、次の手順に沿って、テストデバイスをプログラムで登録します。
-
Update()
を呼び出します。 ログ出力で次のようなメッセージを確認します。このメッセージには、デバイス ID と、テストデバイスとして追加する方法が示されています。
Android
Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.
iOS
<UMP SDK>To enable debug mode for this device, set: UMPDebugSettings.testDeviceIdentifiers = @[2077ef9a63d2b398840261c8221a0c9b]
テストデバイス ID をクリップボードにコピーします。
DebugGeography.TestDeviceHashedIds
を呼び出してテストデバイス ID のリストを渡すようにコードを変更します。
void Start()
{
var debugSettings = new ConsentDebugSettings
{
DebugGeography = DebugGeography.TestDeviceHashedIds =
new List<string>
{
"TEST-DEVICE-HASHED-ID"
}
};
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
ConsentDebugSettings = debugSettings,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
地域を強制的に適用する
UMP SDK では、 the DebugGeography
field on ConsentDebugSettings
を使用して、デバイスが EEA または英国にあるかのようにアプリの動作をテストできます。デバッグ設定はテストデバイスでのみ機能します。
void Start()
{
var debugSettings = new ConsentDebugSettings
{
// Geography appears as in EEA for debug devices.
DebugGeography = DebugGeography.EEA,
TestDeviceHashedIds = new List<string>
{
"TEST-DEVICE-HASHED-ID"
}
};
// Set tag for under age of consent.
// Here false means users are not under age of consent.
ConsentRequestParameters request = new ConsentRequestParameters
{
TagForUnderAgeOfConsent = false,
ConsentDebugSettings = debugSettings,
};
// Check the current consent information status.
ConsentInformation.Update(request, OnConsentInfoUpdated);
}
同意ステータスをリセットする
UMP SDK でアプリをテストする際、ユーザーの初回インストール エクスペリエンスをシミュレートできるように、SDK の状態をリセットすると便利な場合があります。SDK には、これを行う Reset()
メソッドが用意されています。
ConsentInformation.Reset();