
안녕하세요.
위젯에 <div id="pc-ad-container"></div> 이것만 넣어주시고,
tail 쪽에서 아래와같이 넣어보세요!
<script>
(function () {
function rbInitPcAdOnce() {
if (window.innerWidth <= 768) return false;
var container = document.getElementById('pc-ad-container');
if (!container) return false;
var slotId = 'container-12345678';
var slot = document.getElementById(slotId);
if (!slot) {
slot = document.createElement('div');
slot.id = slotId;
container.appendChild(slot);
}
var src = 'https://.../invoke.js';
var exists = document.querySelector('script[data-rb-ad="pc"][src="' + src + '"]');
if (exists) return true;
var s = document.createElement('script');
s.async = true;
s.setAttribute('data-cfasync', 'false');
s.setAttribute('data-rb-ad', 'pc');
s.src = src;
(document.head || document.documentElement).appendChild(s);
return true;
}
// 최초 한번 시도
if (rbInitPcAdOnce()) return;
// ajax로 dom이 나중에 들어오는 경우 감시
if (!('MutationObserver' in window)) {
// 폴백
var tries = 0;
var t = setInterval(function () {
tries++;
if (rbInitPcAdOnce() || tries > 40) clearInterval(t);
}, 250);
return;
}
var ob = new MutationObserver(function () {
if (rbInitPcAdOnce()) ob.disconnect();
});
ob.observe(document.documentElement, { childList: true, subtree: true });
})();
</script>
테스트를 못해봐서 안될 수 도 있습니다. 위젯은 ajax로 로드되는방식이라
위젯안에 스크립트를 넣으면 실행이 되지 않을 수 있습니다.
2.2.6 에서 개선될 수 있습니다.
2026-03-02 22:05