개인 정보 보호 및 메시지 JavaScript API

소개

이 API는 개인 정보 보호 및 메시지 탭에서 제공하는 메시지와 상호작용하는 도구를 제공합니다. 콘솔을 사용하여 다음을 할 수 있습니다.

다음 도구를 사용하여 업계 표준 프로토콜을 통해 사용자 동의를 수집할 수도 있습니다.

이 경우 동의 상태는 이러한 API를 통해 전달됩니다.

다음과 같은 몇 가지 방법으로 사이트에 이 사용자 메시지 기능을 배포할 수 있습니다.

  1. 대부분의 경우 다시 태그할 필요가 없습니다. 관련 제품에 메시지가 게시되면 기존 Google 게시자 태그 또는 애드센스 태그가 사용자 메시지를 배포합니다.
  2. 광고 차단 해제 요청 메시지를 사용하는 경우 페이지에 광고 차단 태그를 명시적으로 추가해야 합니다. 자세한 내용은 광고 관리자AdSense 태그 지정 안내를 참고하세요.

googlefc는 사용자 메시지 기능이 JavaScript Window의 API에 사용하는 전역 네임스페이스입니다.

필드 요약

이름 유형 정의
googlefc.controlledMessagingFunction function(!Object) 메시지를 계속 진행할지 여부를 결정하는 함수입니다. 이 기능은 모든 메시지 유형에서 지원됩니다.
googlefc.callbackQueue !Array<!Object<string, function()>> | !Array<function()> | !googlefc.CallbackQueue 사용자 메시지 쿼리의 비동기 실행을 위한 콜백 대기열에 대한 참조입니다.
googlefc.CallbackQueue !Object 콜백 대기열 객체의 유형입니다.
googlefc.AdBlockerStatusEnum !Object<string, number> 사용자의 광고 차단 프로그램 상태를 나타내는 enum입니다.
googlefc.AllowAdsStatusEnum !Object<string, number> 사용자의 광고 허용 상태를 나타내는 enum입니다.
googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum !Object<string, number> 사용자의 초기 미국 주 거부 상태를 나타내는 enum입니다. 여기에는 사용자가 위치한 미국 주가 고려됩니다.
googlefc.GoogleFcConsentModeUserStatus !Object googlefc.getGoogleConsentModeValues의 반환 유형입니다.
googlefc.ConsentModePurposeStatusEnum !Object<string, number> 동의 모드 목적에 대한 최종 사용자의 결정을 나타내는 enum입니다.
googlefc.usstatesoptout.overrideDnsLink undefined|boolean 자체 맞춤 '판매 또는 공유 금지' 링크를 사용하도록 true로 설정할 수 있는 불리언입니다.
googlefc.ccpa.InitialCcpaStatusEnum

기존. googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum을 선호합니다.
!Object<string, number> 사용자의 초기 미국 주 규정 상태를 나타내는 enum입니다.
googlefc.ccpa.overrideDnsLink

기존. googlefc.usstatesoptout.overrideDnsLink을 선호합니다.
undefined|boolean 자체 맞춤 '판매 또는 공유 금지' 링크를 사용하도록 true로 설정할 수 있는 불리언입니다.

메서드 요약

이름 반환 유형 정의
googlefc.showRevocationMessage() 정의되지 않음 동의 레코드를 지우고 googlefc 스크립트를 다시 로드하여 사용자에게 적용되는 동의 메시지를 표시합니다.
googlefc.getAdBlockerStatus() 숫자 사용자의 광고 차단 상태에 따라 AdBlockerStatusEnum의 값을 반환합니다.
googlefc.getAllowAdsStatus() 숫자 사용자의 광고 허용 상태에 따라 AllowAdsStatusEnum의 값을 반환합니다.
googlefc.usstatesoptout.getInitialUsStatesOptOutStatus() 숫자 사용자의 초기 미국 주 규정 수신 거부 상태에 따라 InitialUsStatesOptOutStatusEnum의 값을 반환합니다. 이는 사용자의 현재 위치에 적용되는 규정을 고려합니다.
googlefc.usstatesoptout.openConfirmationDialog(function(boolean)) 정의되지 않음 기본 판매 또는 공유 거부 링크가 재정의된 경우 미국 주 규정 선택 해제 확인 대화상자를 엽니다.
googlefc.getGoogleConsentModeValues() !Object 사용자의 현재 동의 모드 값을 포함하는 googlefc.GoogleFcConsentModeUserStatus 객체를 반환합니다. 사용 가능한 동의 모드 목적별로 하나씩 반환됩니다.
googlefc.ccpa.getInitialCcpaStatus()

기존. googlefc.usstatesoptout.getInitialUsStatesOptOutStatus()을 선호합니다.
숫자 사용자의 초기 미국 주 규정 수신 거부 상태에 따라 InitialCcpaStatusEnum의 값을 반환합니다.
googlefc.ccpa.openConfirmationDialog(function(boolean))

기존. googlefc.usstatesoptout.openConfirmationDialog()을 선호합니다.
정의되지 않음 기본 판매 또는 공유 거부 링크가 재정의된 경우 미국 주 규정 선택 해제 확인 대화상자를 엽니다.

사이트에서 테스트 및 디버깅

개인 정보 보호 및 메시지에는 실제 사이트에서 특정 메시지, 메시지의 하위 유형 또는 메시지 조합이 어떻게 표시되는지 확인할 수 있는 디버깅 및 테스트 기능이 제공됩니다.

기본 요건:

  • 미리 보려는 메시지가 테스트 중인 사이트에 게시되어 있어야 합니다.

다음 디버깅 URL 매개변수를 사용하여 사이트에서 실시간 미리보기를 확인할 수 있습니다.

디버그 매개변수 허용되는 값
fc alwaysshow (디버그/미리보기 모드 트리거)
fctype ab (광고 차단 메시지), ccpa (미국 주 규정 거부 메시지), gdpr (GDPR 동의 메시지), monetization (오퍼월 메시지), usfl (미국 주 규정 거부 메시지, 플로리다 전용), usnat (미국 주 규정 거부 메시지, 플로리다를 제외한 모든 지원 주, ccpa와 동일)

사이트 (foo.com)에서 미리 보는 방법의 예는 다음과 같습니다.

  • 미국 주 규정 거부 메시지 테스트 -- http://foo.com/?fc=alwaysshow&fctype=ccpa
  • GDPR 메시지 테스트 -- http://foo.com/?fc=alwaysshow&fctype=gdpr

필드: 설명 및 예시

googlefc.controlledMessagingFunction {function(!Object)}

메시지를 표시해야 하는지 여부를 결정하는 함수입니다. 구독자 상태 또는 페이지 URL과 같은 게시자가 지정한 조건에 따라 메시지 렌더링을 제한하는 데 사용할 수 있습니다.

다른 스크립트가 로드되기 전에 Window에서 googlefc.controlledMessagingFunction를 정의하면 message.proceed(boolean)를 호출할 때까지 메시지가 표시되지 않습니다. message.proceed(true)를 호출하면 메시지가 평소와 같이 진행되지만 message.proceed(false)를 호출하면 페이지 조회에 메시지가 표시되지 않습니다.

예를 들어 로그인한 사용자가 구독자인지 확인하는 비동기 함수 determineIfUserIsSubscriber()를 정의하는 스크립트가 페이지에 있다고 가정해 보겠습니다.

<head>
  <script>
    window.isSubscriber = undefined;
    function determineIfUserIsSubscriber() {
      if (isSubscriber !== undefined) {
        return isSubscriber;
      }
      return new Promise(resolve => {
        setTimeout(() => {
          // Change this to true if you want to test what subscribers would see.
          window.isSubscriber = false;
          resolve(window.isSubscriber);
        }, 1000);
      });
    }
  </script>
</head>

다음은 googlefc.controlledMessagingFunction를 사용하여 비구독자에게만 메시지를 표시하는 방법의 예입니다.

<head>
  <script>
    // Define googlefc and the controlled messaging function on the Window.
    window.googlefc = window.googlefc || {};
    googlefc.controlledMessagingFunction = async (message) => {
      // Determine if the user is a subscriber asynchronously.
      const isSubscriber = await determineIfUserIsSubscriber();

      if (isSubscriber) {
        // If the user is a subscriber, don't show any messages.
        message.proceed(false);
      } else {
        // Otherwise, show messages as usual.
        message.proceed(true);
      }
    }
  </script>
</head>

게시자가 Offerwall만 표시되지 않도록 지정할 수 있는 이 기능의 확장 버전도 있습니다. 이 기능 확장 프로그램을 사용하여 다른 메시지 유형을 억제하지 않고 Offerwall을 억제합니다.

Offerwall 전용 관리 메시지는 googlefc.MessageTypeEnum 유형의 Arraymessage.proceed()에 추가 매개변수를 전달하여 구현됩니다.

예: 다음은 googlefc.controlledMessagingFunction를 사용하여 다른 메시지 유형을 억제하지 않고 구독자에 대한 오퍼월 게재만 억제하는 예입니다.

<head>
  <script>
    // Define googlefc and the controlled messaging function on the Window.
    window.googlefc = window.googlefc || {};
    googlefc.controlledMessagingFunction = async (message) => {
     // Determine if the Offerwall should display or not.
     const shouldDisplayOfferwall = await determineIfUserIsSubscriber();
     const applicableMessageTypes = [];

     if (!shouldDisplayOfferwall) {
       // Do not show the Offerwall, but allow other message types to display.
       applicableMessageTypes.push(window.googlefc.MessageTypeEnum.OFFERWALL);
       message.proceed(false, applicableMessageTypes);
     } else {
       // Otherwise, show messages as usual.
       message.proceed(true);
     }
    }
  </script>
</head>

googlefc.callbackQueue {!Array<!Object<string, function()>> | !Array<function()> | !googlefc.CallbackQueue}

메시지 관련 호출의 비동기 실행을 위한 전역 콜백 대기열에 대한 참조입니다. 함수를 호출하는 유일한 지원 방법은 callbackQueue에 함수를 추가하는 것입니다.

다양한 유형의 데이터는 서로 다른 시간에 제공되므로 다음 문자열 중 하나를 키로, 실행할 함수를 값으로 사용하여 함수를 맵으로 추가해야 합니다.

지원되는 키:

키 이름 사용 상대적 지연 시간
CONSENT_API_READY CONSENT_API_READY 키를 사용하여 콜백 대기열에 푸시된 함수는 지원되는 동의 프레임워크의 API가 정의되고 호출 가능할 때 실행됩니다. 이 시점부터 이후에 추가된 CONSENT_API_READY 키가 지정된 함수의 실행은 동기식입니다. 프레임워크 관련 세부정보는 IAB 프레임워크 섹션을 참고하세요. 낮음
CONSENT_DATA_READY 지원되는 동의 프레임워크에 따라 수집된 사용자 동의가 알려지면 (이전 실행에서 또는 사용자가 동의 메시지와 상호작용한 후) CONSENT_DATA_READY 키를 사용하여 콜백 대기열로 푸시된 함수가 실행됩니다. 이 시점부터 이후에 추가된 CONSENT_DATA_READY 키가 지정된 함수의 실행은 동기식입니다. 높음
AD_BLOCK_DATA_READY AD_BLOCK_DATA_READY 키를 사용하여 콜백 대기열로 푸시된 함수는 흐름에서 광고 차단 데이터를 사용할 수 있게 되면 실행됩니다. 이 시점부터 이후에 추가된 AD_BLOCK_DATA_READY 키가 지정된 함수의 실행은 동기식입니다. 높음
CONSENT_MODE_DATA_READY CONSENT_MODE_DATA_READY 키를 사용하여 콜백 대기열로 푸시된 함수는 Google [동의 모드](https://support.google.com/google-ads/answer/10000067)(Google Ads 및 애널리틱스 태그와 함께 사용) 데이터가 흐름에서 제공될 때 실행됩니다. 동의 모드 데이터가 준비되면 언제든지 googlefc.getGoogleConsentModeValues를 사용하여 동의 모드 값에 액세스할 수 있습니다. 보통
INITIAL_US_STATES_OPT_OUT_DATA_READY INITIAL_US_STATES_OPT_OUT_DATA_READY 키를 사용하여 콜백 대기열로 푸시된 함수는 흐름에서 미국 주 규정 데이터를 사용할 수 있게 되면 실행됩니다. 미국 주 규정 데이터에 대한 후속 요청은 GPP API (__gpp)를 직접 호출하여 가져와야 합니다. 보통
INITIAL_CCPA_DATA_READY 미국 주 규정의 기존 키입니다. INITIAL_US_STATES_OPT_OUT_DATA_READY을 선호합니다.

INITIAL_CCPA_DATA_READY 키를 사용하여 콜백 대기열로 푸시된 함수는 흐름에서 미국 주 규정 데이터를 사용할 수 있게 되면 실행됩니다. 미국 주 규정 데이터에 대한 후속 요청은 GPP API (__gpp)를 직접 호출하여 가져와야 합니다.
보통

googlefc.CallbackQueue {!Object}

메서드 요약:

이름 유형 매개변수 반환 유형 역할
push(data) 숫자 data: 키가 데이터 가용성 유형 중 하나이고 값이 실행할 JavaScript 함수인 키-값 쌍입니다. 허용되는 데이터 가용성 키는 CONSENT_API_READY, CONSENT_DATA_READY, AD_BLOCK_DATA_READY, INITIAL_US_STATES_OPT_OUT_DATA_READY, CONSENT_MODE_DATA_READY, INITIAL_CCPA_DATA_READY (레거시)입니다. 지금까지 추가된 명령어 수입니다. 이렇게 하면 배열의 현재 길이가 반환됩니다. 데이터가 사용 가능해지는 순서대로, 그리고 이러한 함수가 대기열에 추가되는 순서대로 전달된 함수를 실행합니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  googlefc.callbackQueue.push({
    'AD_BLOCK_DATA_READY':
    () => {
      if (googlefc.getAdBlockerStatus() == googlefc.AdBlockerStatusEnum.NO_AD_BLOCKER) {
        // Handle a non-ad blocking user.
      }
    }
  });
</script>

googlefc.AdBlockerStatusEnum {!Object<string, number>}

사용자의 다양한 광고 차단 상태를 나타냅니다. 다양한 상태는 다음과 같습니다.

googlefc.AdBlockerStatusEnum = {
  // Something failed, in an unknown state.
  UNKNOWN: 0,
  // The user was running an extension level ad blocker.
  EXTENSION_AD_BLOCKER: 1,
  // The user was running a network level ad blocker.
  NETWORK_LEVEL_AD_BLOCKER: 2,
  // The user was not blocking ads.
  NO_AD_BLOCKER: 3,
};

googlefc.AllowAdsStatusEnum {!Object<string, number>}

사용자의 다양한 광고 차단 해제 요청 광고 허용 상태를 나타냅니다. 다양한 상태는 다음과 같습니다.

googlefc.AllowAdsStatusEnum = {
  // Something failed, in an unknown state.
  UNKNOWN: 0,
  // User is currently using an ad blocker, was never using an ad blocker, or
  // allowed ads, but not because they saw the Privacy & messaging message.
  ADS_NOT_ALLOWED: 1,
  // User is no longer using an ad blocker after seeing the ad blocking message.
  ADS_ALLOWED: 2,
};

googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum{!Object<string, number>}

사용자의 다양한 미국 주 규정 거부 상태를 나타냅니다. 다양한 상태는 다음과 같습니다.

googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum = {
  // Something failed, status unknown.
  UNKNOWN: 0,
  // No US state regulation applies to this user.
  DOES_NOT_APPLY: 1,
  // A US state regulation applies to this user, and the user has not opted out yet.
  NOT_OPTED_OUT: 2,
  // A US state regulation applies to this user, and the user has opted out.
  OPTED_OUT: 3,
};

googlefc.GoogleFcConsentModeUserStatus{!Object}

googlefc.getGoogleConsentModeValues에서 반환된 객체의 유형입니다.

interface GoogleFcConsentModeUserStatus {

  // End user consent decision value for the ad_storage consent mode purpose.
  adStoragePurposeConsentStatus: number;

  // End user consent decision value for the ad_user_data consent mode purpose.
  adUserDataPurposeConsentStatus: number;

  // End user consent decision value for the ad_personalization consent mode purpose.
  adPersonalizationPurposeConsentStatus: number;

  // End user consent decision value for the analytics_storage consent mode purpose.
  analyticsStoragePurposeConsentStatus: number;
}

각 필드의 값은 googlefc.ConsentModePurposeStatusEnum enum 값에 해당하는 숫자입니다.


googlefc.ConsentModePurposeStatusEnum{!Object<string, number>}

동의 모드 목적에 대해 가능한 다양한 최종 사용자 동의 값을 나타냅니다. 다양한 값은 다음과 같습니다.

googlefc.ConsentModePurposeStatusEnum = {
  // Indicates either an error state, or that consent mode data is not ready
  // yet.
  UNKNOWN: 0,
  // Consent is granted for the given consent mode purpose.
  GRANTED: 1,
  // Consent is denied for the given consent mode purpose.
  DENIED: 2,
  // Consent is not applicable for the given consent mode purpose.
  NOT_APPLICABLE: 3,
  // The consent mode purpose has not been configured for use in the Privacy &
  // messaging UI.
  NOT_CONFIGURED: 4
};

googlefc.usstatesoptout.overrideDnsLink{undefined|boolean}

기본 '개인 정보 판매 또는 공유 금지' 링크를 숨기고 자체 맞춤 '개인 정보 판매 또는 공유 금지' 링크를 사용하려면 이 필드를 true로 설정하세요.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  // Signals that the default DNS link will be overridden.
  googlefc.usstatesoptout.overrideDnsLink = true;
</script>

googlefc.ccpa.InitialCcpaStatusEnum{!Object<string, number>}

사용자의 다양한 미국 주 규정 거부 상태를 나타냅니다. 다양한 상태는 다음과 같습니다.

googlefc.ccpa.InitialCcpaStatusEnum = {
  // Something failed, in an unknown state.
  UNKNOWN: 0,
  // No US state regulation applies to this user.
  CCPA_DOES_NOT_APPLY: 1,
  // A US state regulation applies to this user, and the user has not opted out yet.
  NOT_OPTED_OUT: 2,
  // A US state regulation applies to this user, and the user has opted out.
  OPTED_OUT: 3,
};

googlefc.ccpa.overrideDnsLink{undefined|boolean}

기본 '개인 정보 판매 또는 공유 금지' 링크를 숨기고 자체 맞춤 '개인 정보 판매 또는 공유 금지' 링크를 사용하려면 이 필드를 true로 설정하세요. 이 필드를 true로 설정하면 사이트에 '내 개인 정보를 판매하거나 공유하지 마세요' 링크를 렌더링해야 합니다. 이 필드는 openConfirmationDialog와 함께 사용해야 합니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.ccpa = window.googlefc.ccpa || {};
  // Signals that the default DNS link will be overridden.
  googlefc.ccpa.overrideDnsLink = true;
</script>

메서드: 설명 및 예

googlefc.getConsentStatus(): {number}


googlefc.getConsentedProviderIds(): {!Array<string>}

  1. 이제 호출되면 항상 빈 목록이 반환됩니다.

googlefc.showRevocationMessage(): {undefined}

현재 EU 규정 동의 기록이 있는 경우 이를 삭제하고 사용자가 동의 결정을 변경할 수 있도록 EU 규정 메시지를 다시 표시합니다.

예 1: 클릭하면 취소 메시지가 표시되는 링크를 설정하는 간단한 예입니다.

<a href="javascript:window.googlefc.showRevocationMessage();">Privacy and cookie settings</a>
<a href="javascript:window.googlefc.showRevocationMessage();" style="display: none;" id="revocation-link">Privacy and cookie settings</a>
<script>
  window.googlefc = window.googlefc || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];
  window.googlefc.callbackQueue.push({
    'CONSENT_API_READY':
    () => {
      // Update the revocation link so that it shows on the page.
      const revocationLink = document.getElementById('revocation-link');
      revocationLink.style.display = 'block';
    }
  });
</script>

예 2: 현재 사용자에게 EU 규정이 적용될 때만 링크가 표시되도록 하려면 TCF API와 함께 googlefc 콜백 대기열을 사용하여 gdprApplies 값이 결정되면 이를 기반으로 버튼의 표시를 조건부로 업데이트하면 됩니다. 이를 위해 CONSENT_API_READY API 키를 사용합니다.

<a href="javascript:window.googlefc.showRevocationMessage();" style="display: none;" id="revocation-link">Privacy and cookie settings</a>
<script>
  window.googlefc = window.googlefc || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];
  window.googlefc.callbackQueue.push({
    'CONSENT_API_READY':
    // Specifying "0" for the version parameter will result in the API call
    // using the latest version of the TCF spec.
    () => __tcfapi('addEventListener', 0, (tcdata, success) => {
      const revocationLink = document.getElementById('revocation-link');
      if (!success || !tcdata) {
        // Something went wrong, don't show the revocation link.
        revocationLink.style.display = 'none';
      }
      else if (tcdata.gdprApplies) {
        revocationLink.style.display = 'block';
      } else {
        // GDPR does not apply so don't show the revocation link.
        revocationLink.style.display = 'none';
      }
    })
  });
</script>

googlefc.getAdBlockerStatus(): {number}

사용자의 광고 차단 상태에 따라 AdBlockerStatusEnum의 값을 반환합니다. 이 함수에 지정해야 하는 키는 AD_BLOCK_DATA_READY입니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  googlefc.callbackQueue.push({
    'AD_BLOCK_DATA_READY':
    () => {
      switch (googlefc.getAdBlockerStatus()) {
          case googlefc.AdBlockerStatusEnum.EXTENSION_LEVEL_AD_BLOCKER:
          case googlefc.AdBlockerStatusEnum.NETWORK_LEVEL_AD_BLOCKER:
            // Insert handling for cases where the user is blocking ads.
            break;
          case googlefc.AdBlockerStatusEnum.NO_AD_BLOCKER:
            // Insert handling for cases where the user is not blocking ads.
            break;
          case googlefc.AdBlockerStatusEnum.UNKNOWN:
            // Insert handling for unknown cases.
            break;
      }
    }
  });
</script>

googlefc.getAllowAdsStatus(): {number}

사용자의 광고 허용 상태에 따라 AllowAdsStatusEnum의 값을 반환합니다. 이 함수에 지정해야 하는 키는 AD_BLOCK_DATA_READY입니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  googlefc.callbackQueue.push({
    'AD_BLOCK_DATA_READY':
    () => {
      switch (googlefc.getAllowAdsStatus()) {
        case googlefc.AllowAdsStatusEnum.ADS_NOT_ALLOWED:
          // Insert handling for cases where the user has not allowed ads.
          // The user may have never been an ad blocker.
          break;
        case googlefc.AllowAdsStatusEnum.ADS_ALLOWED:
          // Insert handling for cases where the user saw the ad blocking
          // message and allowed ads on the site.
          break;
        case googlefc.AllowAdsStatusEnum.UNKNOWN:
          // Insert handling for unknown cases.
          break;
      }
    }
  });
</script>

googlefc.usstatesoptout.getInitialUsStatesOptOutStatus(): {number}

사용자의 미국 주 규정 거부 상태에 따라 InitialUsStatesOptOutStatusEnum의 값을 반환합니다. 이 함수에 지정해야 하는 키는 INITIAL_US_STATES_OPT_OUT_DATA_READY입니다. 미국 주 규정 데이터에 대한 후속 요청은 GPP API (__gpp)를 직접 호출하여 가져와야 합니다.

'개인 정보 판매 또는 공유 금지' 링크를 재정의하는 경우 이 메서드를 사용하여 사이트에 링크를 포함할 시기를 결정할 수 있습니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {}
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  googlefc.callbackQueue.push({
    'INITIAL_US_STATES_OPT_OUT_DATA_READY':
    () => {
      switch (googlefc.usstatesoptout.getInitialUsStatesOptOutStatus()) {
        case googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum.DOES_NOT_APPLY:
          // Insert handling for cases where no US state regulation applies to
          // the user.
          break;
        case googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum.NOT_OPTED_OUT:
          // Insert handling for cases where a US state regulation applies to
          // the user, and the user has not opted out.
          break;
        case googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum.OPTED_OUT:
          // Insert handling for cases where a US state regulation applies to the
          // user, and the user has opted out.
          break;
      }
    }
  });
</script>

googlefc.usstatesoptout.openConfirmationDialog(function(boolean)): {undefined}

기본 '내 개인 정보를 판매하지 마세요' 링크가 재정의된 경우 미국 주 규정 선택 해제 확인 대화상자를 엽니다. 사용자가 확인 대화상자와 상호작용하면 사용자가 선택 해제하기로 결정한 경우 true로, 그렇지 않은 경우 false로 제공된 콜백 함수가 호출됩니다.

예:

<script>
// This callback will be called with the user's US state regulation opt-out
// decision.
const usStateRegCompletionCallback = (userOptedOut) => {
  // Insert handling for user opt-out status here.
}
// Invoke the US state regulations confirmation dialog when the user clicks the
// link.
document.getElementById("your-custom-do-not-sell-link").addEventListener(
  "click", () => googlefc.usstatesoptout.openConfirmationDialog(usStateRegCompletionCallback));
</script>

googlefc.getGoogleConsentModeValues(): {!Object}

사용자의 동의 결정에 따라 각 동의 모드 목적의 현재 값을 포함하는 googlefc.GoogleFcConsentModeUserStatus 객체를 반환합니다.

의도된 사용 사례는 EU 규정에 대한 동의 모드 지원과 함께 Google 동의 관리 솔루션 사용하기를 참고하세요.


googlefc.ccpa.getInitialCcpaStatus(): {number}

사용자의 미국 주 규정 거부 상태에 따라 InitialCcpaStatusEnum의 값을 반환합니다. 이 함수에 지정해야 하는 키는 INITIAL_CCPA_DATA_READY입니다. 미국 주 규정 데이터에 대한 후속 요청은 GPP API (__gpp)를 직접 호출하여 가져와야 합니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.ccpa = window.googlefc.ccpa || {}
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  googlefc.callbackQueue.push({
    'INITIAL_CCPA_DATA_READY':
    () => {
      switch (googlefc.ccpa.getInitialCcpaStatus()) {
        case googlefc.ccpa.InitialCcpaStatusEnum.CCPA_DOES_NOT_APPLY:
          // Insert handling for cases where no US state regulation applies to
          // the user.
          break;
        case googlefc.ccpa.InitialCcpaStatusEnum.NOT_OPTED_OUT:
          // Insert handling for cases where a US state regulation applies to
          // the user, and the user has not opted out.
          break;
        case googlefc.ccpa.InitialCcpaStatusEnum.OPTED_OUT:
          // Insert handling for cases where a US state regulation applies to the
          // user, and the user has opted out.
          break;
      }
    }
  });
</script>

googlefc.ccpa.openConfirmationDialog(function(boolean)): {undefined}

기본 '내 개인 정보를 판매하지 마세요' 링크가 재정의된 경우 미국 주 규정 선택 해제 확인 대화상자를 엽니다. 사용자가 확인 대화상자와 상호작용하면 사용자가 선택 해제하기로 결정한 경우 제공된 콜백 함수가 true로 호출되고, 그렇지 않은 경우 false로 호출됩니다.

예:

<script>
// This callback will be called with the user's US state regulation opt-out
// decision.
const usStateRegCompletionCallback = (userOptedOut) => {
  // Insert handling for user opt-out status here.
}
// Invoke the US state regulations confirmation dialog when the user clicks the
// link.
document.getElementById("your-custom-ccpa-do-not-sell-link").addEventListener(
  "click", () => googlefc.ccpa.openConfirmationDialog(ccpaCompletionCallback));
</script>

Google 동의 관리 솔루션을 사용하여 IAB TCF v2 프레임워크에 따라 GDPR 동의를 수집하는 경우 IAB TCF v2 API를 사용해야 합니다.

CONSENT_API_READY 콜백 대기열 키를 사용하여 IAB TCF v2 API가 페이지에 정의된 경우에만 해당 콜백이 호출되도록 할 수 있습니다. 이는 IAB TCF v2 API의 'addEventListener' 명령어와 함께 사용해야 합니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback using the CONSENT_API_READY key on the callbackQueue.
  window.googlefc.callbackQueue.push({
    'CONSENT_API_READY':
    () => __tcfapi('addEventListener', 2.2, (data, success) => {
      // Do something with consent data value; this callback may be invoked
      // multiple times as user completes consent flow.
    })
  });
</script>

CONSENT_DATA_READY 콜백 대기열 키를 사용하여 IAB TCF v2 API를 사용하여 사용자 동의가 수집되고 액세스할 수 있는 경우에만 해당 콜백이 호출되도록 할 수 있습니다. 이는 'addEventListener' 명령어와 함께 사용할 수 있습니다. 제공된 콜백의 첫 번째 호출에 제공된 데이터에는 사용자의 동의 선택이 포함됩니다 (TCF v2가 이 사용자에게 적용되는 경우). TCF v2.2가 출시됨에 따라 'getTCData' 명령어가 지원 중단되었습니다.

예:

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback using the CONSENT_DATA_READY key on the callbackQueue.
  window.googlefc.callbackQueue.push({
    'CONSENT_DATA_READY':
    () => __tcfapi('addEventListener', 2.2, (data, success) => {
      // Do something with consent data value; this callback may be invoked
      // multiple times if user consent selections change.
    })
  });
</script>

Google 동의 관리 솔루션은 Google 동의 모드에 대한 사용자의 EU 규정 동의 여부를 해석할 수 있습니다(자세한 내용은 고객센터 참고).

동의 모드는 Google Ads 및 애널리틱스 문서에 설명된 대로 기본 모드 또는 고급 모드로 구현할 수 있습니다. 법적 요구사항을 충족하기 위해 어떤 동의 모드를 구현해야 하는지 법무팀과 상담하세요.

고급 동의 모드는 기본적으로 지원됩니다. 개인 정보 보호 및 메시지 UI에서 동의 모드를 사용 설정하면 추가 작업이 필요하지 않습니다.

Google 동의 관리 솔루션을 사용하여 기본 동의 모드를 구현하려면 동의 모드 데이터를 사용할 수 있게 되면 CONSENT_MODE_DATA_READY 콜백 대기열 키를 사용하여 Google Ads 및 애널리틱스 태그를 조건부로 로드하면 됩니다. 동의 모드 데이터는 Funding Choices에서 이 요청에 동의 모드가 적용되지 않는다고 판단한 후 (예: 이 요청에 EU 규정이 적용되지 않음) 또는 사용자가 EU 규정 동의 결정을 내린 후에 사용할 수 있습니다. 동의 모드를 사용할 수 있게 되면 태그를 로드할 수 있는지 여부를 판단하는 데 사용할 기준에 관해 법무팀과 상담해야 합니다.

예를 들어 최종 사용자의 동의 결정과 관계없이 동의 모드 데이터를 사용할 수 있게 되면 태그를 로드하려면 다음 단계를 따르세요.

<script>
// Make sure that the properties exist on the window.
window.googlefc = window.googlefc || {};
window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

// Helper function to load Google Ads/Analytics tags once consent mode data is
// ready.
const loadGtagScript = () => {
  // Load gtag.js script - code taken from
  // https://developers.google.com/tag-platform/security/guides/consent?consentmode=basic#set_up_consent_mode
  var gtagScript = document.createElement('script');
  gtagScript.async = true;
  gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=<Google tag ID>';

  var firstScript = document.getElementsByTagName('script')[0];
  firstScript.parentNode.insertBefore(gtagScript,firstScript);
}

// Queue the callback using the CONSENT_MODE_DATA_READY key on the callbackQueue.
window.googlefc.callbackQueue.push({
  'CONSENT_MODE_DATA_READY':
  () => {
      loadGtagScript();
  },
});
</script>

동의 모드 데이터를 사용할 수 있는 경우 googlefc.getGoogleConsentModeValues() API를 사용하여 개별 동의 모드 목적의 값을 가져올 수도 있습니다. 이 API는 지원되는 각 동의 모드 목적의 필드가 하나씩 포함된 GoogleFcConsentModeUserStatus 객체를 반환하며 각 필드의 값은 해당 동의 모드 목적의 값을 나타내는 enum 값입니다.

예를 들어 다음 중 하나에 해당하는 경우에만 googlefc.getGoogleConsentModeValues()를 사용하여 Google Ads 및 애널리틱스 태그를 차단 해제할 수 있습니다.

  • 최종 사용자가 모든 동의 모드 목적에 동의하는 EU 규정 동의 결정을 내리는 경우 또는
  • 모든 동의 모드 목적이 현재 요청에 적용되지 않습니다 (EU 규정이 적용되지 않거나 개인 정보 보호 및 메시지에서 하나 이상의 목적에 대해 동의 모드가 구성되지 않은 경우 발생할 수 있음).
<script>
// Make sure that the properties exist on the window.
window.googlefc = window.googlefc || {};
window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

// Helper function to determine whether Google Ads and Analytics tags can be
// unblocked. Returns true if all consent mode purposes are set to GRANTED,
// NOT_APPLICABLE, or NOT_CONFIGURED.
const shouldUnblockConsentTags = (googleFcConsentModeStatus) => {
  const allConsentModeValues = [
    googleFcConsentModeStatus.adStoragePurposeConsentStatus,
    googleFcConsentModeStatus.adUserDataPurposeConsentStatus,
    googleFcConsentModeStatus.adPersonalizationPurposeConsentStatus,
    googleFcConsentModeStatus.analyticsStoragePurposeConsentStatus
  ];
  for (const consentModeValue of allConsentModeValues) {
    switch (consentModeValue) {
      case googlefc.ConsentModePurposeStatusEnum.CONSENT_MODE_PURPOSE_STATUS_UNKNOWN:
        // Indicates either an error case or that consent mode data is not
        // ready yet. Cannot unblock tags until consent data is ready and valid,
        // so return false.
        return false;
      case googlefc.ConsentModePurposeStatusEnum.CONSENT_MODE_PURPOSE_STATUS_GRANTED:
        // Consent is granted for this consent mode purpose.
        break;
      case googlefc.ConsentModePurposeStatusEnum.CONSENT_MODE_PURPOSE_STATUS_DENIED:
        // Consent is denied for this consent mode purpose. Do not unblock tags.
        return false;
      case googlefc.ConsentModePurposeStatusEnum.CONSENT_MODE_PURPOSE_STATUS_NOT_APPLICABLE:
        // Consent mode does not apply for this purpose.
        break;
      case googlefc.ConsentModePurposeStatusEnum.CONSENT_MODE_PURPOSE_STATUS_NOT_CONFIGURED:
        // Consent mode not configured for this purpose.
        // If you configured support for Ads purposes but not Analytics purposes in the
        // Privacy & messaging UI, the value of `analyticsStoragePurposeConsentStatus` will
        // always be set to NOT_CONFIGURED. If you do not enable any Consent Mode support
        // in the Privacy & messaging UI, the values of all purposes will always be set to
        // NOT_CONFIGURED.
        break;
      default:
        console.log("Unexpected consent mode value encountered");
    }
  }
  // If all prior checks pass, all consent mode values are either GRANTED,
  // NOT_APPLICABLE, or NOT_CONFIGURED.
  return true;
};

// Helper function to load Google Ads/Analytics tags.
const loadGtagScript = () => {
  // Load gtag.js script - code taken from
  // https://developers.google.com/tag-platform/security/guides/consent?consentmode=basic#set_up_consent_mode
  var gtagScript = document.createElement('script');
  gtagScript.async = true;
  gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=<Google tag ID>';

  var firstScript = document.getElementsByTagName('script')[0];
  firstScript.parentNode.insertBefore(gtagScript,firstScript);
}

googlefc.callbackQueue.push({
  CONSENT_MODE_DATA_READY: () => {
    if (shouldUnblockConsentTags(googlefc.getGoogleConsentModeValues())) {
      loadGtagScript();
    }
  },
});
</script>

Google 동의 관리 솔루션을 사용하여 IAB GPP 프레임워크에 따라 최종 사용자에게 미국 주 규정 선택 해제 메시지를 제공하는 경우 IAB GPP API를 사용해야 합니다.

미국 주 규정의 선택 해제 특성으로 인해 CONSENT_API_READY 또는 CONSENT_DATA_READY 콜백 대기열 키를 사용하여 콜백이 호출될 때 IAB GPP API가 호출 가능하고 동의 데이터를 반환하는지 확인할 수 있습니다.

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Queue the callback on the callbackQueue.
  window.googlefc.callbackQueue.push({
    'CONSENT_DATA_READY':
    () => __gpp('ping', (data, success) => {
        // Do something with consent data value.
    })
  });
</script>

Google 동의 관리 솔루션을 사용하여 IAB GPP 프레임워크에 따라 최종 사용자에게 미국 주 규정 선택 해제 메시지를 제공하는 경우 googlefc.usstatesoptout.overrideDnsLink 플래그를 true로 설정하여 자체 맞춤 '판매 또는 공유 금지' 링크를 제공할 수 있습니다.

<script>
  // Make sure that the properties exist on the window.
  window.googlefc = window.googlefc || {};
  window.googlefc.usstatesoptout = window.googlefc.usstatesoptout || {};
  window.googlefc.callbackQueue = window.googlefc.callbackQueue || [];

  // Signals that the default DNS link will be overridden.
  window.googlefc.usstatesoptout.overrideDnsLink = true;

  // Register the callback for the initial US state regulations data.
  window.googlefc.callbackQueue.push({
      'INITIAL_US_STATES_OPT_OUT_DATA_READY': () => {
        if (googlefc.usstatesoptout.getInitialUsStatesOptOutStatus() ===
            googlefc.usstatesoptout.InitialUsStatesOptOutStatusEnum.NOT_OPTED_OUT) {
          // TODO: Display custom Do Not Sell or Share link here.
        }
      }
    });
</script>

이렇게 하면 기본 '내 정보 판매 또는 공유 금지' 링크가 렌더링되지 않습니다. 그런 다음 미국 주 규정 선택 해제 확인 대화상자를 호출하여 맞춤 판매 또는 공유 거부 링크와의 사용자 상호작용을 처리해야 합니다.

자체 맞춤 판매 또는 공유 거부 링크를 사용하는 경우 링크가 미국 주 규정을 준수하는지 확인할 책임은 사용자에게 있습니다.

<script>
// This callback will be called when the user makes a US state regulations
// decision.
const usStateRegCompletionCallback = (userOptedOut) => {
  if (userOptedOut) {
    // TODO: Hide custom Do Not Sell or Share link here.
  }
}
// Invoke the US state regulations opt-out confirmation dialog when the user
// clicks the link.
document.getElementById("your-custom-do-not-sell-link").addEventListener(
  "click", () => googlefc.usstatesoptout.openConfirmationDialog(usStateRegCompletionCallback));
</script>