You need to enable JavaScript to run this app.
导航

客户端展现上报

最近更新时间2023.02.28 17:57:49

首次发布时间2021.10.18 11:12:18

该接口用于列表页图文或视频内容曝光事件上报,火山引擎支持上报单条和多条内容曝光事件。

单条曝光

请求方式

请求方法

GET/POST(Content-Type: application/x-www-form-urlencoded)

请求url

https://mercury.volcengineapi.com/?Action=SingleShowLog&Version=2021-01-01

请求header

ServiceName:content

请求参数

参数描述类型是否必填说明
Partner渠道号String
AccessToken用户唯一标识String
GroupId内容idString对应“获取个性化内容”接口返回的GroupId
Category频道IDString对应“获取个性化内容”接口传入的Category值,在相关推荐场景Category固定传related
EventTime事件发生时间String十位时间戳,单位:秒;表示内容被曝光的时间
Dt设备型号String如iphone5s、Galaxy。主要用于推荐分析,提升推荐效果
DeviceBrand设备厂商String如Apple、Samsung。主要用于推荐分析,提升推荐效果
Os操作系统String如 Android、IOS。主要用于推荐分析,提升推荐效果。
OsVersion操作系统版本String如4.0.4。主要用于推荐分析,提升推荐效果。
ClientVersion应用的版本号String比如1.0.1。主要用于数据排查,提升业务指标
FromGid相关推荐来源内容idString相关推荐场景特有,表示从哪条内容点进来的;如在内容A的详情页-->相关推荐曝光的内容有B,C,D,这个时候B,C,D的FromGid均为A
ReqId请求唯一标识String表示该内容具体是从哪一次请求返回的,便于数据分析。
该值对应公共响应参数中的RequestId

响应参数

参数描述类型说明
Result上报结果Stringsuccess:成功

请求示例

public static void main(String[] args) {
    //初始化一个service
    LogService logService = LogServiceImpl.getInstance();

    //设置ak,sk 此为请求的凭证
    logService.setAccessKey("xxx");
    logService.setSecretKey("xxx");

    //初始化一个request
    SingleShowLogRequest req = new SingleShowLogRequest();
    req.setPartner("xxx");
    req.setAccessToken("xxx");
    req.setGroupId("6938426748178530823");
    req.setCategory("xxx");
    req.setEventTime("1626861782");
    req.setDt("iphone6s");
    req.setOs("iOS");
    req.setOsVersion("12");
    req.setClientVersion("7.3.25");
    req.setDeviceBrand("Apple");
    try {
        LogResponse response = logService.singleShowLog(req);
        System.out.println(JSON.toJSONString(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

响应示例

{
  "ResponseMetadata": {
    "Action": "SingleShowLog",
    "Region": "cn-north-1",
    "RequestId": "20220721133221010212070069204A4CE4",
    "Service": "content",
    "Version": "2021-01-01"
  },
  "Result": "success"
}

多条曝光

请求方式

请求方法

POST(Content-Type: application/json)

请求url

https://mercury.volcengineapi.com/?Action=MultiShowLog&Version=2021-01-01

请求header

ServiceName:content

请求参数

参数
描述
类型
是否必填
说明
Partner
渠道号
String
AccessToken
用户唯一标识
String
Body
请求体
List<Body>

响应参数

参数描述类型说明
Result上报结果Stringsuccess:成功

请求示例

public static void main(String[] args) {
    //初始化一个service
    LogService logService = LogServiceImpl.getInstance();

    //设置ak,sk 此为请求的凭证
    logService.setAccessKey("xxx");
    logService.setSecretKey("xxx");

    //初始化一个request
    MultiShowLogRequest req = new MultiShowLogRequest();
    req.setPartner("xxx");
    req.setAccessToken("xxx");
    List<MultiShowLogRequest.Body> bodyList = new ArrayList<>();
    MultiShowLogRequest.Body body = new MultiShowLogRequest.Body();    body.setGroupId("7008339270066766349");
    body.setCategory("xxx");
    body.setEventTime(1626861782);
    body.setFromGid("6938426748178530823");
    body.setDt("iphone6s");
    body.setOs("iOS");
    body.setOsVersion("1.0.0");
    body.setClientVersion("7.3.25");
    body.setDeviceBrand("Apple");
    bodyList.add(body);

    MultiShowLogRequest.Body body1 = new MultiShowLogRequest.Body();
    body1.setGroupId("7008339270066766349");
    body1.setCategory("xxx");
    body1.setEventTime(1626861782);
    body1.setFromGid("6938426748178530823");
    body1.setDt("iphone6s");
    body1.setOs("iOS");
    body1.setOsVersion("1.0.0");
    body1.setClientVersion("7.3.25");
    body1.setDeviceBrand("Apple");
    bodyList.add(body1);
    
    req.setBody(bodyList);
    try {
        LogResponse response = logService.multiShowLog(req);        System.out.println(JSON.toJSONString(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

响应示例

{
  "ResponseMetadata": {
    "Action": "MultiShowLog",
    "Region": "cn-north-1",
    "RequestId": "2022072113480001021204519702455953",
    "Service": "content",
    "Version": "2021-01-01"
  },
  "Result": "success"
}