StandardResponse
更新时间:2019-06-14
Cloud-SSP通过StandardResponse返回竞价成功的广告,本节将介绍StandardResponse对象。
4.1 StandardResponse Obect
参数 | 类型 | 含义 |
---|---|---|
id | string | 请求ID,与Request中ID对应 |
ad | object[] | 返回的广告创意列表 |
4.1.1 Ad对象
参数 | 类型 | 含义 |
---|---|---|
adm | string | HTML片段封装的广告创意 |
admvideo | string | VAST协议的视频广告格式 |
admaudio | string | VAST音频广告格式 |
admnative | string | JSON格式原生广告信息,具体JSON字段说明参见附录 |
key | string | 广告位字符串唯一标识 |
说明
adm、admvideo、admaudio、admnative四者只会填充一个
4.1.2 admnative json对象规约
AdmNative
参数 | 类型 | 含义 |
---|---|---|
click | object | 点击对象 |
impression | string[] | 展现监控url数组 |
width | string | 广告宽度 |
height | string | 广告高度 |
title | string | 广告标题 |
desc | string | 广告描述 |
desc2 | string | 广告描述2 |
displayurl | string | 展示链接 |
icon/logo/image/image2/image3/image4/image5/image6/image7/image8/image9/image10/flash | object | 创意物料对象 |
sponsored | string | 赞助商 |
rating | string | 评分 |
likes | string | 好评数 |
downloads | string | 下载量 |
price | string | 原始价格 |
saleprice | string | 打折价格 |
phone | string | 电话 |
address | string | 地址 |
ctatext | string | 按钮文本 |
Click Object
参数 | 类型 | 含义 |
---|---|---|
url | string | 点击响应url |
monitor | string[] | 点击监控url数组 |
Image Object
参数 | 类型 | 含义 |
---|---|---|
url | string | 图片url |
width | string | 图片宽 |
height | string | 图片高 |
4.2. Sample StandardResponse
4.2.1 StandardResponse for webview
{
"id": "",
"ad": [
{
"adm": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title></title>\n <meta http-equiv=\"Content-Type\" content=\"text/html\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n <script type=\"text/javascript\">\n function visitUrl(url) {\n var img = new Image();\n img.src = url;\n return img;\n }\n\n function visitAllUrls(urls) {\n for (var i = 0; i < urls.length; i++) {\n visitUrl(urls[i]);\n }\n }\n\n function imageClicked() {\n var clickMonitorUrls = [\"http://email.google.com\"];\n visitAllUrls(clickMonitorUrls);\n }\n </script>\n <style>\n * {\n margin: 0px;\n padding: 0px;\n }\n img {\n border: 0;\n }\n #adv-main-image,\n body,\n div,\n html {\n width: 100%;\n height: 100%;\n }\n .product {\n position: relative;\n }\n .adv-logo {\n position: absolute;\n bottom: 1px;\n z-index: 100;\n }\n .ad-label {\n left: 1px;\n }\n .dsp-logo {\n right: 1px;\n }\n </style>\n </head>\n <body>\n <div class=\"product\" id=\"adv-container\">\n <a href=\"http://180.76.156.47:9555/clk/standard?p=khQn2jojzbZCvWdgbPh-VeAfmyOoMUyvrqk4sMVHWO6_5p-cOi7GXRHc6fC0CttW05BVHnNmuDIBnJPmqNbxBVlpHxM-E1BDL0EZWxSX3IW0uVpP67kD3CZnWl1Zv3WLtTVZkNJSIy_cR_kXIXsifA==&lp=aHR0cDovL2Nsb3VkLmJhaWR1LmNvbQ==\" target=\"_blank\" onclick=\"imageClicked()\">\n <img src=\"http://cloud-ssp.cdn.bcebos.com/a07fcbdb-9c1f-4103-bc54-d726ed40be3b.jpg\" id=\"adv-main-image\">\n </a>\n <img src=\"\" class=\"adv-logo ad-label\" onerror=\"this.style.display='none'\">\n <img src=\"\" class=\"adv-logo dsp-logo\" onerror=\"this.style.display='none'\">\n </div>\n <img src=\"http://www.google.com\" style=\"display:none\" /><img src=\"http://180.76.156.47:9555/imp/standard?p=khQn2jojzbZCvWdgbPh-VeAfmyOoMUyvrqk4sMVHWO6_5p-cOi7GXRHc6fC0CttW05BVHnNmuDIBnJPmqNbxBVlpHxM-E1BDL0EZWxSX3IW0uVpP67kD3CZnWl1Zv3WLtTVZkNJSIy_cR_kXIXsifA==\" style=\"display:none\" /></body>\n</html>\n"
}
]
}
解析adm字段获取渲染片段供webview加载
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta http-equiv="Content-Type" content="text/html">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script type="text/javascript">
function visitUrl(url) {
var img = new Image();
img.src = url;
return img;
}
function visitAllUrls(urls) {
for (var i = 0; i < urls.length; i++) {
visitUrl(urls[i]);
}
}
function imageClicked() {
var clickMonitorUrls = ["http://email.google.com"];
visitAllUrls(clickMonitorUrls);
}
</script>
<style>
* {
margin: 0px;
padding: 0px;
}
img {
border: 0;
}
#adv-main-image,
body,
div,
html {
width: 100%;
height: 100%;
}
.product {
position: relative;
}
.adv-logo {
position: absolute;
bottom: 1px;
z-index: 100;
}
.ad-label {
left: 1px;
}
.dsp-logo {
right: 1px;
}
</style>
</head>
<body>
<div class="product" id="adv-container">
<a href="http://180.76.156.47:9555/clk/standard?p=khQn2jojzbZCvWdgbPh-VeAfmyOoMUyvrqk4sMVHWO6_5p-cOi7GXRHc6fC0CttW05BVHnNmuDIBnJPmqNbxBVlpHxM-E1BDL0EZWxSX3IW0uVpP67kD3CZnWl1Zv3WLtTVZkNJSIy_cR_kXIXsifA==&lp=aHR0cDovL2Nsb3VkLmJhaWR1LmNvbQ==" target="_blank" onclick="imageClicked()">
<img src="http://cloud-ssp.cdn.bcebos.com/a07fcbdb-9c1f-4103-bc54-d726ed40be3b.jpg" id="adv-main-image">
</a>
<img src="" class="adv-logo ad-label" onerror="this.style.display='none'">
<img src="" class="adv-logo dsp-logo" onerror="this.style.display='none'">
</div>
<img src="http://www.google.com" style="display:none" /><img src="http://180.76.156.47:9555/imp/standard?p=khQn2jojzbZCvWdgbPh-VeAfmyOoMUyvrqk4sMVHWO6_5p-cOi7GXRHc6fC0CttW05BVHnNmuDIBnJPmqNbxBVlpHxM-E1BDL0EZWxSX3IW0uVpP67kD3CZnWl1Zv3WLtTVZkNJSIy_cR_kXIXsifA==" style="display:none" /></body>
</html>
4.2.2 StandardResponse for native ad.
{
"id": "",
"ad": [
{
"admnative": "{\"click\":{\"url\":\"http://ssp.cloud.baidu.com/clk/standard?p=ZlJ7r0__pixel_encoded_info__jUrN__please_do_not_modify__bdw9G0Q==&lp=aHR__landing_page_info__NvbQ\",\"monitor\":[\"https://click_monitor.baidu.com/clicked?id=918\",\"http://click_monitor2.baidu.com/clicked?slot=214\"]},\"impression\":[\"https://ssp.cloud.baidu.com/imp/standard?p=ZlJ7r0__pixel_encoded_info__jUrN__please_do_not_modify__bdw9G0Q==\",\"http://imp_monitor.baidu.com/impression?slot=214\"],\"width\":\"600\",\"height\":\"500\",\"title\":\"Cloud-SSP帮您快速变现\",\"desc\":\"BaiduCloudSSP旨在帮助拥有流量资源的客户在百度智能云上迅速搭建供给方平台,实现专业、高效、高回报的流量变现\",\"desc2\":\"SSP包含业务端、检索端、控制台,可以实现广告位管理、实时监控、A/Btest、日志服务等功能,同时支持直投、公开竞价等多种主流变现形式。成为CloudSSP的客户,我们将利用百度广告领先的技术与丰富经验助您流量变现\",\"displayurl\":\"https://cloud.baidu.com/product/ssp.html\",\"icon\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/icon.jpg\",\"width\":\"90\",\"height\":\"90\"},\"logo\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/logo.jpg\",\"width\":\"90\",\"height\":\"90\"},\"image\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/image.jpg\",\"width\":\"240\",\"height\":\"200\"},\"image2\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/image_2.jpg\",\"width\":\"240\",\"height\":\"200\"},\"image3\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/image_3.jpg\",\"width\":\"240\",\"height\":\"200\"},\"image4\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/image_4.jpg\",\"width\":\"240\",\"height\":\"200\"},\"image5\":{\"url\":\"https://cdn.ssp.cloud.baidu.com/image_5.jpg\",\"width\":\"240\",\"height\":\"200\"},\"image6\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"image7\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"image8\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"image9\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"image10\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"flash\":{\"url\":\"\",\"width\":\"\",\"height\":\"\"},\"sponsored\":\"百度智能云\",\"rating\":\"5\",\"likes\":\"1024\",\"downlaods\":\"1024\",\"price\":\"1000000\",\"saleprice\":\"1000000\",\"phone\":\"021-12345678\",\"address\":\"百度研发中心\",\"ctatext\":\"来一打!\"}
"
}
]
}
解析admnative字段,获取广告原生内容,注意对应url需要用于响应行为回调。
{
"click": {
"url": "http://ssp.cloud.baidu.com/clk/standard?p=ZlJ7r0__pixel_encoded_info__jUrN__please_do_not_modify__bdw9G0Q==&lp=aHR__landing_page_info__NvbQ",
"monitor": [
"https://click_monitor.baidu.com/clicked?id=918",
"http://click_monitor2.baidu.com/clicked?slot=214"
]
},
"impression": [
"https://ssp.cloud.baidu.com/imp/standard?p=ZlJ7r0__pixel_encoded_info__jUrN__please_do_not_modify__bdw9G0Q==",
"http://imp_monitor.baidu.com/impression?slot=214"
],
"width": "600",
"height": "500",
"title": "Cloud-SSP 帮您快速变现",
"desc": "Baidu Cloud SSP旨在帮助拥有流量资源的客户在百度智能云上迅速搭建供给方平台,实现专业、高效、高回报的流量变现",
"desc2": "SSP包含业务端、检索端、控制台,可以实现广告位管理、实时监控、A/B test、日志服务等功能,同时支持直投、公开竞价等多种主流变现形式。成为Cloud SSP的客户,我们将利用百度广告领先的技术与丰富经验助您流量变现",
"displayurl": "https://cloud.baidu.com/product/ssp.html",
"icon": {
"url": "https://cdn.ssp.cloud.baidu.com/icon.jpg",
"width": "90",
"height": "90"
},
"logo": {
"url": "https://cdn.ssp.cloud.baidu.com/logo.jpg",
"width": "90",
"height": "90"
},
"image": {
"url": "https://cdn.ssp.cloud.baidu.com/image.jpg",
"width": "240",
"height": "200"
},
"image2": {
"url": "https://cdn.ssp.cloud.baidu.com/image_2.jpg",
"width": "240",
"height": "200"
},
"image3": {
"url": "https://cdn.ssp.cloud.baidu.com/image_3.jpg",
"width": "240",
"height": "200"
},
"image4": {
"url": "https://cdn.ssp.cloud.baidu.com/image_4.jpg",
"width": "240",
"height": "200"
},
"image5": {
"url": "https://cdn.ssp.cloud.baidu.com/image_5.jpg",
"width": "240",
"height": "200"
},
"image6": {
"url": "",
"width": "",
"height": ""
},
"image7": {
"url": "",
"width": "",
"height": ""
},
"image8": {
"url": "",
"width": "",
"height": ""
},
"image9": {
"url": "",
"width": "",
"height": ""
},
"image10": {
"url": "",
"width": "",
"height": ""
},
"flash": {
"url": "",
"width": "",
"height": ""
},
"sponsored": "百度智能云",
"rating": "5",
"likes": "1024",
"downlaods": "1024",
"price": "1000000",
"saleprice": "1000000",
"phone": "021-12345678",
"address": "百度研发中心",
"ctatext": "来一打!"
}