本文档为WPS参照Open-RTB文档,根据自己的需求进行修改应用的版本,主要是精简了暂时用不到的一些规范内容。
简要说明
1.发起Bid Request请求广告资源
2.回复Bid Response或者vast包括必要的广告资源
请求使用JSON格式
xAccept: application/json
Content-type: application/json; charset=utf-8
对象属性名 | 类型和必须 | 描述 |
---|---|---|
id | string;required | 请求唯一ID号 |
imp | object array;required | Imp对象的数组,最少需要imp对象 |
device | object;required | 设备信息 |
app | object;required | app媒体信息 |
deal | object array;optional | 交易相关 Deal对象是一个数组,当Deal为单独的cpc底价时,回来的广告只能是cpc出价,当Deal为单独的cpm底价时,回来的广告只能是cpm出价。当Deal数组中有两个对象,cpc底价和cpm底价时,回来的广告既可以是cpm出价,也可以是cpc出价,出价方式只能是一种。无论任何情况价格都要高于底价。 |
test | integer default 0; optional | 0 = live,1=test |
tmax | integer;optional | 超时时间,单位为毫秒值。 |
user | object;optional | 用户信息。 |
对象属性名 | 类型 | 描述 |
---|---|---|
banner | object | 当请求banner广告时必须 |
对象属性名 | 类型 | 描述 |
---|---|---|
w | integer;optional | 广告位的width |
h | integer;optional | 广告位的height |
wmax | integer;optional | 广告位最大宽度 |
hmax | integer;optional | 广告位最大高度 |
wmin | integer;optional | 广告位最小的宽度 |
hmin | integer;optional | 广告位最小的高度 |
iamount | integer;optional | 广告位图片数量 |
bidtype | integer;required | 广告位类型取值(开屏 = 1,信息流大卡 = 3,信息流单图 = 5,视频开屏=34,pc气泡=23等) 详细参照下面广告位详情 |
对象属性名 | 类型 | 描述 |
---|---|---|
ua | string;required | user agent |
ip | string;required | ip 地址 |
make | string;optional | 设备制造商 |
model | string;optional | 设备名称 |
os | string;optional | 设备操作系统(IOS,android,Windows) |
osv | string;optional | 操作系统版本 |
h | integer;optional | 物理像素高 |
w | integer;optional | 物理像素宽 |
language | string;optional | 浏览器语言 |
carrier | string;optional | ISP名称 |
connectiontype | integer;optional | 网络连接类型 |
ifa | string;optional | ios设备信息值 |
imei | string;optional | android设备的imei值 |
oaid | string;optional | android设备的OAID值(Open Anonymous ID) |
aid | string;optional | android设备的aid |
mac | string;optional | 设备的网络mac |
dpidmd5 | string;optional | 平台设备信息 device ID (e.g., Android ID); MD5值. |
macmd5 | string;optional | MAC address of the device; MD5. |
对象属性名 | 类型 | 描述 |
---|---|---|
bidfloor | string;required | 底价 default 0,单位(人民币 分)浮点数的字符串表示 例如: bidfloor:"5600.00". |
chargetype | integer;required | 计价方式( 2 = cpc , 1 = cpm ) |
对象属性名 | 类型 | 描述 |
---|---|---|
id | string;required | APP 唯一ID号. |
name | string;optional | app的名字(金山词霸,金山WPS等) |
bundle | string;optional | APP bundle or package name (e.g., com.foo.mygame); |
ver | string;optional | App version |
APP 媒体信息取值 | APP名称 |
---|---|
5 | WPS Android |
27 | WPS iOS |
对象属性名 | 类型 | 描述 |
---|---|---|
gender | String;optional | 性别男m,女f,未知'',可选,具体由商务决定 |
tags | String array;optional | 用户的标签 |
address | object;optional | 地址,可选,具体由商务决定 |
对象属性名 | 类型 | 描述 |
---|---|---|
country | String;optional | 国家 |
province | String;optional | 省 |
city | String;optional | 市 |
对象属性名 | 类型 | 描述 |
---|---|---|
id | string;required | 对应于这次请求的request id |
seatbid | object array;required | seatbid对象数组 |
对象属性名 | 类型 | 描述 |
---|---|---|
bid | object array; required | bid对象数组 |
对象属性名 | 类型 | 描述 |
---|---|---|
id | string,required | id |
adomain | string array;optional | 广告主的域名信息 |
bundle | string;optional | app 下载类广告的包名信息,当App是下载类广告时,需要填写此字段 |
iconurl | string;optional | 当isappdownload 是 1时候需要给一个app的iconurl |
iurl | string array;required | 广告图片地址 |
h | integer;optional | 广告的高(像素值) |
w | integer;optional | 广告的宽(像素值) |
title | string;required | 广告标题 |
description | string;required | 广告描述 |
clickurl | string;required | 点击跳转url地址 |
imprtrackurl | string array;required | 展示上报地址,支持宏替换,具体支持字段见下方参数说明 |
clicktrackurl | string array;required | 点击上报地址/开始下载上报地址,支持相关点击坐标宏替换,具体支持字段见下方参数说明 |
downloadedurl | string array;required | 下载完成上报地址/开始安装上报地址 |
installedurl | string array;required | 安装完成上报地址 |
price | float;(java BigDecimal) required | 价格 单位(人民币 分) 当chargetype为cpm时,这里的价格表示的1000次展示的价格 当chargetype为cpc时,这里的价格表示的1次点击的价格 |
chargetype | integer;required | 计价方式( 2 = cpc , 1 = cpm ) |
isappdownload | integer;optional | 0 = no, 1= yes ,广告是否为app直接下载类型广告即clickurl是否为app直接下载地址。 |
style | integer array;required | 广告风格标签 取值请参考 http://ads-web.ksosoft.com/doc/kingsoft/styleandindustry.pdf |
industry | integer array;required | 广告行业标签 取值请参考 http://ads-web.ksosoft.com/doc/kingsoft/styleandindustry.pdf |
winnotice | string ;optional | 广告的赢价通知 |
deepLink | string ;optional | deeplink的值,当appDeepLink为true时,为必填字段 |
appDeepLink | bool;optional | 当前广告是否是app deeplink广告 |
#####其中imprtrackurl或者clicktrackurl中需要返回价格的需要宏替换格式,格式为:http://www.kingsoft.com?price={price}
#####宏替换的位置可以放在任何位置
参数 | 宏 | 描述 |
---|---|---|
request_id | {request_id} | 广告请求的request id |
bid | {bid} | 广告id |
price | {bid_price} | 最终成交价,加密价格,单位(人民币 分) |
ip | {ip} | 用户的ip |
did | {did} | 用户的设备id |
__TS__ | 曝光或点击发生的时间戳 | |
__DOWN_X__ | 用户手指按下时的广告位相对横坐标 | |
__DOWN_Y__ | 用户手指按下时的广告位相对纵坐标 | |
__UP_X__ | 用户手指离开屏幕时的广告位相对横坐标 | |
__UP_Y__ | 用户手指离开屏幕时的广告位相对纵坐标 |
价格加密采用 google 自定义的加密机制
https://developers.google.com/ad-exchange/rtb/response-guide/decrypt-price#encryptionscheme
wiki:https://github.com/google/openrtb-doubleclick/wiki
java实例代码
xxxxxxxxxx
/**
* Created by hzg on 2017/7/10.
*/
public class WinnoticeUtil {
public static final byte[] KEY1 = "kingsoft".getBytes();
public static final byte[] KEY2 = "adx".getBytes();
public static final BigDecimal ZERO = new BigDecimal(0);
public static final BigDecimal ONEHUNDRED = new BigDecimal(100);
public static DoubleClickCrypto.Price clickCrypto = null;
static {
try {
DoubleClickCrypto.Keys keys = new DoubleClickCrypto.Keys(
new SecretKeySpec(KEY1, "HmacSHA1"),
new SecretKeySpec(KEY2, "HmacSHA1")
);
clickCrypto = new DoubleClickCrypto.Price(keys);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String encrytPrice(BigDecimal price) {
if (price == null) {
price = ZERO;
}
return clickCrypto.encodePriceValue(price.multiply(ONEHUNDRED).doubleValue(), null);
}
public static String encrytPrice(String price) {
if (price == null) {
return encrytPrice(ZERO);
}
return encrytPrice(new BigDecimal(price));
}
public static String replacePrice(String url, Object... param) {
if (StringUtils.isEmpty(url)) {
return "";
}
return MessageFormat.format(url, param);
}
public static List<String> replaceUrls(List<String> urls, String price) {
if (price == null) {
return replaceUrls(urls, ZERO);
}
return replaceUrls(urls, new BigDecimal(price));
}
public static List<String> replaceUrls(List<String> urls, BigDecimal price) {
List<String> replaceUrls = Lists.newArrayList();
if (CollectionUtils.isEmpty(urls)) {
return replaceUrls;
}
for (String url : urls) {
replaceUrls.add(replacePrice(url, encrytPrice(price)));
}
return replaceUrls;
}
public static void main(String[] args) throws SignatureException {
//加密
String cryptoStr = clickCrypto.encodePriceValue(12,null);
System.out.println(cryptoStr);
//解密
System.out.println(clickCrypto.decodePriceValue(cryptoStr));
}
}
输出
XJwszwAM1ShpYgxpFjZCHnpjOT-uc5s7eH0PzA==
12
c++ 实例:
http://ads-web.ksosoft.com/doc/kingsoft/wps_price_decrypt_demo.rar
媒体信息 | 广告位类型 | 广告位信息 | 素材要求 width * height |
---|---|---|---|
WPS 安卓 | 开屏 = 1 | 首页开屏 | 图片尺寸:1224px*1953px,图片大小:<=150K ,广告形式:展示类、deeplink,说明:内容区域在宽度1080px以内,安全区域是:1080*1524,建议使用Banner中的w、h来匹配素材 |
WPS 安卓 | 信息流大卡 = 3 | 信息流大卡 | 支持两种形式:大图卡和三图卡,大图卡图片尺寸:912px*483px,三图卡图片尺寸:228*151;图片大小:<=50K,标题:必传,不超过20个字符,描述:非必传,不超过22个字符,描述:非必传,不超过22个字符,广告形式: 展示类、下载类、deeplink |
WPS 安卓 | 信息流单图卡 = 5 | 信息流单图卡 | 图片尺寸:108px*108px,图片大小:<=30K,标题:必传,不超过18个字符,描述:非必传,不超过22个字符,广告形式: 展示类、下载类、deeplink |
WPS 安卓 | 首页缩略图 = 116 | 首页缩略图 | 必传,图片尺寸1280*720,图片大小:<=300kb,icon:必传,icon尺寸:108*108,标题:必传,不超过15个字符,描述:非必传,不超过22个字符,广告形式: 展示类、下载类、deeplink |
WPS iOS | 开屏 = 1 | 首页开屏 | 图片尺寸:828px*1472px,图片大小:<=150K,广告形式:展示类、deeplink |
WPS iOS | 信息流大卡 = 3 | 信息流大卡 | 图片尺寸:768px*384px,图片大小:<=50K, 标题:必填,不超过18个字符 ,描述:非必传,不超过22个字符,广告形式:展示类、下载类、deeplink |
WPS iOS | 首页缩略图 = 116 | 首页缩略图 | 必传,图片尺寸1280*720,图片大小:<=300kb,icon:必传,icon尺寸:108*108,标题:必传,不超过15个字符,描述:非必传,不超过22个字符,广告形式: 展示类、下载类、deeplink |
WPS iOS | 信息流单图卡 = 5 | 信息流单图卡 | 图片尺寸:68px*68px,图片大小:<=30K,标题:必传,不超过12个字符,描述:非必传,不超过16个字符,广告形式: 展示类、下载类、deeplink |
值 | 描述 |
---|---|
0 | 未知 |
1 | 以太网 |
2 | WIFI |
3 | 蜂窝网络 |
4 | 蜂窝网络 – 2G |
5 | 蜂窝网络 – 3G |
6 | 蜂窝网络 – 4G |
值 | 描述 |
---|---|
wifi | WiFi |
中国联通 | 中国联通 |
中国移动 | 中国移动 |
中国电信 | 中国电信 |
xxxxxxxxxx
{
"id" : "b52c96bea30646abf8170f333bbd42b9",
"test": 0,
"tmax":2000,
"deal":[{
"bidfloor":"34",
"chargetype":1,
},{
"bidfloor":"5600",
"chargetype":2
}],
"app":{
"id":"3",
"name":"词霸Android",
"bundle":"com.kingsoft.ciba",
"ver":"9.0.298"
},
"imp": [
{
"banner": {
"h": 250,
"w": 300,
"wmax": 1280,
"hmax": 800,
"wmin": 120,
"hmin": 80,
"bidtype":1
}
}
],
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
"ip": "123.145.167.10",
"make":"HUAWEI",
"model":"HUAWEI NXT-AL10",
"os":"Android",
"osv":"6.0",
"language": "zh",
"carrier": "中国联通",
"connectiontype":4,
"dpidmd5":"84b7ba514e305ac102fc49189c4926ee",
"macmd5":"84b7ba514e305ac102fc49189c4926ee",
"imei","862591032242252"
}
}
xxxxxxxxxx
{
"id" : "b52c96bea30646abf8170f333bbd42b9",
"seatbid":[
{
"bid":[{
"id":"b42c96bea30646abf8170f333bbd42c0",
"adomain":["jd.com","360buy.com"],
"bundle":"com.jd.app",
"iconurl":"http://www.jd.com/icon.png",
"iurl":["http://www.jd.com/x.jpg"],
"h":240,
"w":320,
"title":"京东618",
"description":"京东618广告",
"clickurl":"http://www.jd.com/x.html",
"imprtrackurl":["http://www.jd.com/trackurl"],
"clicktrackurl":["http://www.jd.com/clicktrackurl"],
"price":3000,
"chargetype":1,
"isappdownload":1
},{
"id":"b42c96bea30646abf8170f333bbd42c5",
"adomain":["jd.com","360buy.com"],
"bundle":"com.jd.app",
"iconurl":"http://www.jd.com/icon.png",
"iurl":["http://www.jd.com/x.jpg"],
"h":240,
"w":320,
"title":"京东618",
"description":"京东618广告",
"clickurl":"http://www.jd.com/x.html",
"imprtrackurl":["http://www.jd.com/trackurl"],
"clicktrackurl":["http://www.jd.com/clicktrackurl"],
"price":3000,
"chargetype":1,
"isappdownload":1
}]
}
]
}
xxxxxxxxxx
{
"id" : "b52c96bea30646abf8170f333bbd42b9",
"seatbid":[
{
"bid":[{
"id":"b42c96bea30646abf8170f333bbd42c0",
"adomain":["jd.com","360buy.com"],
"bundle":"com.jd.app",
"iurl":["http://www.jd.com/x.jpg"],
"h":240,
"w":320,
"title":"京东618",
"description":"京东618广告",
"clickurl":"http://www.jd.com/x.html",
"imprtrackurl":["http://www.jd.com/trackurl"],
"clicktrackurl":["http://www.jd.com/clicktrackurl"],
"price":3000,
"chargeType":1,
"isappdownload":0,
"industry":[10001,10012],
"style":[20001,20003],
"winnotice":"http://xxx.com/winnotice?request_id={request_id}&bid={bid}&price={price}&ip={ip}&did={did}"
},{
"id":"b42c96bea30646abf8170f333bbd42c5",
"adomain":["jd.com","360buy.com"],
"bundle":"com.jd.app",
"iurl":["http://www.jd.com/x.jpg"],
"h":240,
"w":320,
"title":"京东618",
"description":"京东618广告",
"clickurl":"http://www.jd.com/x.html",
"imprtrackurl":["http://www.jd.com/trackurl"],
"clicktrackurl":["http://www.jd.com/clicktrackurl"],
"price":3000,
"chargeType":1,
"isappdownload":0,
"industry":[10001,10012],
"style":[20001,20003],
"winnotice":"http://xxx.com/winnotice?request_id={request_id}&bid={bid}&price={price}&ip={ip}&did={did}"
}]
}
]
}
xxxxxxxxxx
{
"id" : "b52c96bea30646abf8170f333bbd42b9"
}