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": "Ad Title",
"body": "Ad body content goes here.",
"callToAction": "Learn More",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "Advertiser Name",
"link": "https://advertiser.com"
}
}
}
Learn how to request native ads using the 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": "Ad Title",
"body": "Ad body content goes here.",
"callToAction": "Learn More",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "Advertiser Name",
"link": "https://advertiser.com"
}
}
}
android, ios, weben_US, ko_KRlight or dark1 to receive asset URLs and tracking pixels. You must implement impression and click tracking manually in this case.0 indicates success.Show result properties
nativeexternal or internal{
"code": 0,
"msg": "OK",
"result": {
"id": "ad_123456",
"format": "nativeAd",
"unit": "YOUR_UNIT_ID",
"w": 320,
"h": 250,
"ad": "<div>...</div>",
"headline": "Ad Title",
"body": "Ad body content goes here.",
"callToAction": "Learn More",
"destinationURL": "https://example.com/landing",
"target": "external",
"profile": {
"displayLogo": "https://cdn.adrop.io/logo.png",
"displayName": "Advertiser Name",
"link": "https://advertiser.com"
}
}
}
trackMode=1, you must track impression and click events manually.
imprTracker URL when the ad is displayed on screen:
// When ad enters viewport
fetch(response.result.imprTracker);
clickTracker URL first when the user clicks the ad, then navigate to destinationURL:
function handleAdClick(adData) {
// Track click
fetch(adData.clickTracker).then(() => {
// Navigate to landing page
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;
// Render ad content
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;
// Track impression
fetch(ad.imprTracker);
// Click event
document.getElementById('native-ad-container').onclick = () => {
fetch(ad.clickTracker).then(() => {
window.open(ad.destinationURL, '_blank');
});
};
}
});
</script>
Was this page helpful?