메인 콘텐츠로 건너뛰기
GET
https://api-v2.adrop.io
/
request
네이티브 광고
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"
        }
    }
}
네이티브 광고는 구조화된 데이터로 반환되어 앱이나 웹의 디자인에 맞게 커스텀 UI를 구현할 수 있습니다.

요청 파라미터

헤더

Authorization
string
required
App Key (adrop_service.json에서 확인)

쿼리 파라미터

unit
string
required
네이티브 광고 유닛 ID
uid
string
사용자 고유 식별자. 광고 노출 빈도 제어와 타겟팅에 사용됩니다.
pf
string
플랫폼. android, ios, web 중 하나
lcl
string
로케일. 예: ko_KR, en_US
theme
string
테마 모드. light 또는 dark
contextId
string
컨텍스트 타겟팅 ID
trackMode
integer
1로 설정 시 에셋 URL과 트래킹 픽셀 반환. 이 경우 노출과 클릭 트래킹을 직접 구현해야 합니다.
adId
string
광고 식별자 (내 기기에서 보기 시 필수)

응답

code
integer
required
응답 코드. 0은 성공을 의미합니다.
msg
string
required
응답 메시지
result
object
광고 데이터
{
    "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>

관련 문서