curl --request GET \
--url https://api-v2.adrop.io/request \
--header 'Authorization: <authorization>'{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "nativeAd",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 250,
"ad": "<div>...</div>",
"headline": "광고 제목",
"body": "광고 본문 내용입니다.",
"callToAction": "자세히 보기",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "광고주명",
"link": "https://advertiser.com"
}
}
}
REST API를 사용하여 네이티브 광고를 요청하는 방법을 안내합니다.
curl --request GET \
--url https://api-v2.adrop.io/request \
--header 'Authorization: <authorization>'{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "nativeAd",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 250,
"ad": "<div>...</div>",
"headline": "광고 제목",
"body": "광고 본문 내용입니다.",
"callToAction": "자세히 보기",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "광고주명",
"link": "https://advertiser.com"
}
}
}
android, ios, web 중 하나ko_KR, en_USlight 또는 dark1로 설정 시 에셋 URL과 트래킹 픽셀 반환. 이 경우 노출과 클릭 트래킹을 직접 구현해야 합니다.0은 성공을 의미합니다.표시 result 속성
nativeexternal 또는 internal{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "nativeAd",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 250,
"ad": "<div>...</div>",
"headline": "광고 제목",
"body": "광고 본문 내용입니다.",
"callToAction": "자세히 보기",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "광고주명",
"link": "https://advertiser.com"
}
}
}
trackMode=1을 사용하는 경우 노출과 클릭 이벤트를 직접 트래킹해야 합니다.
imprTracker URL을 호출합니다:
// 광고가 뷰포트에 진입할 때
fetch(response.result.imprTracker);
clickTracker URL을 먼저 호출한 후 destinationURL로 이동합니다:
function handleAdClick(adData) {
// 클릭 트래킹
fetch(adData.clickTracker).then(() => {
// 랜딩 페이지로 이동
window.open(adData.destinationURL, '_blank');
});
}
<div class="native-ad" id="native-ad-container">
<div class="ad-profile">
<img class="ad-logo" />
<span class="ad-advertiser"></span>
</div>
<img class="ad-image" />
<h3 class="ad-headline"></h3>
<p class="ad-body"></p>
<button class="ad-cta"></button>
</div>
<script>
fetch('https://api-v2.adrop.io/request?unit=YOUR_UNIT_ID&trackMode=1', {
headers: { 'Authorization': 'YOUR_APP_KEY' }
})
.then(res => res.json())
.then(data => {
if (data.code === 0) {
const ad = data.result;
// 광고 콘텐츠 렌더링
document.querySelector('.ad-logo').src = ad.profile.logo;
document.querySelector('.ad-advertiser').textContent = ad.profile.name;
document.querySelector('.ad-image').src = ad.asset;
document.querySelector('.ad-headline').textContent = ad.headline;
document.querySelector('.ad-body').textContent = ad.body;
document.querySelector('.ad-cta').textContent = ad.callToAction;
// 노출 트래킹
fetch(ad.imprTracker);
// 클릭 이벤트
document.getElementById('native-ad-container').onclick = () => {
fetch(ad.clickTracker).then(() => {
window.open(ad.destinationURL, '_blank');
});
};
}
});
</script>
이 페이지가 도움이 되었나요?