기타
[Google Ad Manager] Lazyload 지연로드 적용하기
mysop
2023. 3. 9. 11:03
반응형
https://developers.google.com/publisher-tag/samples/lazy-loading?hl=ko
위 링크에 상세한 방법이 있다
핵심은 아래와 같다.
googletag.defineSlot('/123456789/inventory, [[300, 100], element)
.setTargeting('local', 'lazyload')
.addService(googletag.pubads());
googletag.pubads().enableLazyLoad();
googletag.pubads().enableLazyLoad({
fetchMarginPercent: 50,
renderMarginPercent: 20,
mobileScaling: 2.0
});
googletag.enableServices();
});
- googletag.defineSlot().setTargeting()
- googletag.pubads().enableLazyLoad()
마지막으로 fetchMarginPercent 값에 어느시점에 광고를 읽어들일지 설정해 준다
데모 페이지 : https://googleads.github.io/google-publisher-tag-samples/lazy-loading/js/demo.html
반응형