本文へ移動

同意管理

Google の User Messaging Platform(UMP)SDK は、広告リクエストの前に同意を集めるプライバシー/メッセージングツールです。流れは Google の UMP ガイド(Android / iOS)を見てください。

このプラグインは UMP と iOS の App Tracking Transparency を共通 API で提供します。UMP を使う前に、AdMob で GDPR(一般データ保護規則)メッセージ を作成します。広告主識別子(IDFA)メッセージ も設定できます。IDFA メッセージを公開している場合、UMP が explainer と App Tracking Transparency のダイアログを出します。そのときは requestTrackingAuthorization() を呼ばないでください。

推奨する順序

  1. AdMob.initialize() を呼びます。初期化 を参照してください。
  2. AdMob.requestConsentInfo() を呼びます。
  3. 必要な場合は AdMob.showConsentForm() を呼びます。
  4. consentInfo.canRequestAdstrue のときだけ広告をロードします。
import { AdMob, AdmobConsentStatus } from '@capacitor-community/admob';

await AdMob.initialize();

let consentInfo = await AdMob.requestConsentInfo();
if (consentInfo.isConsentFormAvailable && consentInfo.status === AdmobConsentStatus.REQUIRED) {
  consentInfo = await AdMob.showConsentForm();
}

if (consentInfo.canRequestAds) {
  // Ads may now be requested.
}

method requestConsentInfo(...)

Request user consent information

requestConsentInfo(options?: AdmobConsentRequestOptions | undefined) => Promise<AdmobConsentInfo>

interface AdmobConsentRequestOptions

Prop Type Description Default Since
debugGeography AdmobConsentDebugGeography Sets the debug geography to test the consent locally. 5.0.0
testDeviceIdentifiers string[] An array of test device IDs to allow. Note: On iOS, the ID may renew if you uninstall and reinstall the app. 5.0.0
tagForUnderAgeOfConsent boolean Set to true to provide the option for the user to accept being shown personalized ads. false 5.0.0

interface AdmobConsentInfo

Prop Type Description Since
status AdmobConsentStatus The consent status of the user. 5.0.0
isConsentFormAvailable boolean If true a consent form is available and vice versa. 5.0.0
canRequestAds boolean If true an ad can be shown. 7.0.3
privacyOptionsRequirementStatus PrivacyOptionsRequirementStatus Privacy options requirement status of the user. 7.0.3

enum AdmobConsentStatus

Member Value Description
NOT_REQUIRED 'NOT_REQUIRED' User consent not required.
OBTAINED 'OBTAINED' User consent already obtained.
REQUIRED 'REQUIRED' User consent required but not yet obtained.
UNKNOWN 'UNKNOWN' Unknown consent status, AdsConsent.requestInfoUpdate needs to be called to update it.

method showConsentForm()

Shows a google user consent form (rendered from your GDPR message config).

showConsentForm() => Promise<AdmobConsentInfo>

広告リクエスト可否の判定には canRequestAds を使います。設定したメッセージとユーザーによっては、同意フォームが不要または利用できないことがあります。

iOS のトラッキング許可

UMP の IDFA メッセージを使わない場合だけ、状態が notDetermined のときに App Tracking Transparency を自分でリクエストします。AdMob で IDFA メッセージを設定している場合はこの節をスキップしてください。UMP がそのダイアログを出します。

const tracking = await AdMob.trackingAuthorizationStatus();
if (tracking.status === 'notDetermined') {
  /**
   * If you want to explain tracking before the iOS dialog,
   * present your own UI here, then continue.
   */
  await AdMob.requestTrackingAuthorization();
}

requestTrackingAuthorization() は Android、Web、iOS 14 未満では何もしません。

method trackingAuthorizationStatus()

Returns the current App Tracking Transparency authorization status on iOS 14 and later.
Returns authorized on earlier iOS versions, Android, and web.

trackingAuthorizationStatus() => Promise<TrackingAuthorizationStatusInterface>

interface TrackingAuthorizationStatusInterface

The current iOS App Tracking Transparency authorization status.

Prop Type Description
status 'authorized' | 'denied' | 'notDetermined' | 'restricted' The authorization status reported by App Tracking Transparency.

method requestTrackingAuthorization()

Requests App Tracking Transparency authorization on iOS 14 and later.
Resolves without taking action on earlier iOS versions, Android, and web.

requestTrackingAuthorization() => Promise<void>

プライバシーオプション

プライバシーメッセージがアプリ内の入口を必要とする場合は、設定画面などから次を呼び出せるようにします。

await AdMob.showPrivacyOptionsForm();

method showPrivacyOptionsForm()

Shows a google privacy options form (rendered from your GDPR message config).

showPrivacyOptionsForm() => Promise<void>

同意のリセット

resetConsentInfo() はテスト用です。本番ユーザーの同意選択の消去に使わないでください。

method resetConsentInfo()

Resets the UMP SDK state. Call requestConsentInfo function again to allow user modify their consent

resetConsentInfo() => Promise<void>

デバッグ用の地域設定とテストデバイス ID は テスト を参照してください。