이미지 배너 광고
아래 가이드에서는 배너 광고를 로드하고, 표시하는 방법을 설명합니다.
Last updated
아래 가이드에서는 배너 광고를 로드하고, 표시하는 방법을 설명합니다.
Last updated
<head>
<script>
// nestads 명령어 큐 생성
window.nestads = window.nestads || { cmd: [] };
window.nestads.cmd.push(() => {
window.nestads
.defineSlot("SAMPLE_IMAGE_BANNER/300/250", [300, 250], "banner-ad") // 2. slot 정의
// .defineSlot("SAMPLE_IMAGE_BANNER/300/250", "FLUID", "banner-ad") // 2-1. 변동 사이즈로 정의 가능
.addService(nestads.pubAds()); // 3. 광고 서비스 설정
.setTargeting("age", "20") // 4. 타겟팅 및 표시 설정
.setConfig({
banner: {
backgroundType: "CUSTOM",
backgroundColor: "#ff0000",
backgroundOpacity: 0.5,
},
});
window.nestads.enableServices(); // 5. 광고 서비스 활성화
});
</script>
</head>
<body>
<!--1. 배너 광고 표시할 영역에 div 생성-->
<div id="banner-ad"></div>
<script>
window.nestads.cmd.push(() => {
window.nestads.display("banner-ad"); // 6. 광고 게재
});
</script>
</body>