테스트 모드
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
adBreak() 통합 테스트
adBreak()
API를 사용하는 자바스크립트 코드를 테스트하기 위해 adsbygoogle.js
에 data-adbreak-test="on"
속성을 추가하여 사용 설정할 수 있는 테스트 모드를 제공합니다.
<script async
data-adbreak-test="on"
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-123456789"
crossorigin="anonymous">
</script>
<script>
window.adsbygoogle = window.adsbygoogle || [];
var adBreak = adConfig = function(o) {adsbygoogle.push(o);}
</script>
테스트 모드:
- 실제 광고를 요청하는 대신 모의 광고를 표시합니다.
- 구성된 광고 게재빈도 준수와 같은 실제 광고 동작을 모방합니다.
console.log
또는 전환 지점을 사용하여 adBreakDone()
및 placementInfo
를 디버깅합니다.
참고: 테스트 모드에서는 Google 서버에 광고 요청을 보내지 않고도
클라이언트 측 자바스크립트만 테스트할 수 있습니다. 잘못된 `data-ad-client` 값과 같은
애드센스 코드의 잘못된 구성과 관련된 문제를 감지하는 데
도움이 되지 않습니다.
테스트 모드는 두 가지 시나리오 사이를 순환합니다. 즉, 광고가 항상 제공되지는 않는 실제 환경을 에뮬레이션하기 위해
광고가 로드되거나 로드되지 않습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-01-25(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-01-25(UTC)"],[[["Testing mode for `adBreak()` is enabled by adding `data-adbreak-test=\"on\"` to the `adsbygoogle.js` script tag."],["This mode displays mock ads, mimics real ad behavior (like frequency capping), and allows debugging with `console.log` or breakpoints."],["It's for testing client-side JavaScript only and doesn't detect AdSense code misconfigurations."],["The test mode cycles between scenarios where ads are and aren't loaded to simulate real-world conditions."]]],["To test `adBreak()` API integration, enable testing mode by adding `data-adbreak-test=\"on\"` to the `adsbygoogle.js` script. This mode displays mock ads, mimicking real ad behavior, but does not send real ad requests. It cycles between ad loaded and not loaded scenarios. Use `console.log` or breakpoints to debug `adBreakDone()` and `placementInfo`. This method helps test client-side JavaScript, but it cannot detect issues related to AdSense code misconfiguration.\n"]]