supersdk

文档中心

文档中心

下载文档

Statistics module


The statistics module is an internal integration module and it is used for data statistics reporting of SuperSDK. The module also provides an external interface to the accessor. The accessor can use the external interface to perform custom statistics reporting.

Preparation before integration

The game developer needs to communicate with SuperSDK colleagues first.

Get device information

Interface description: Obtain the device information required for reporting data. It is only used for statistical reporting. The game can also obtain device information by itself. This interface is not mandatory.

Interface invoke:

获取设备信息
//获取统计上报的设备信息,json格式返回,如果游戏需要上报设备信息,可以通过这个接口获取。也可以自己获取
String deviceInfo = SuperSDK.getInstance().InvokString(SuperSDKStats.MODULE_NAME, SuperSDKStats.FUNC_GET_DEVICE_INFO, null);
Debug.Log("deviceInfo:" + deviceInfo);
JsonData json = null;
if(!String.IsNullOrEmpty(deviceInfo)) {
    json = JsonMapper.ToObject(deviceInfo);
    //游戏传入角色信息
    json["roleId"] = "roleId";
    json["roleName] = "roleName";
} 

Log printing:

deviceInfo:
{
    "available_disk_size": "5990141952",                    //SD卡可用大小
    "available_mem_size": "6042570752",                     //内存可用大小
    "battery_remain": "0.66",                               //剩余电量
    "device_cookie": "BvLZPPRh",                            //设备cookie
    "device_id": "860410032119778_879a24fd3f6ab532_0",      //设备ID
    "device_name": "builder",                               //设备名称
    "factory": "Xiaomi",                                    //设备厂商唯一标识
    "idfv": "1232",                                         //渠道ID
    "is_notify": "1",                                       //是否打开推送,1打开,0关闭
    "is_vpn": "0",                                          //是否使用VPN,1使用,0未使用
    "jailbreak": "0",                                       //是否root,1已root,0未root
    "language": "zh",                                       //语言
    "model": "Redmi Note 3",                                //手机型号
    "net_operator": "other",                                //网络运营商,chinaMobile、chinaUnicom、chinaTelecom
    "net_type": "WIFI",                                     //网络类型,WIFI等
    "os": "Android5.0.2",                                   //Android操作系统
    "package_name": "com.youzu.supersdk.demo",              //游戏包名
    "phone_number": "-1",                                   //设备手机号
    "resolution": "1080*1920",                              //设备分辨率
    "total_disk_size": "12413771776",                       //SD卡总容量
    "total_mem_size": "12466200576",                        //内存总容量
    "version": "378"                                        //版本号,AndroidManifest下versionName
}

统计上报

Interface description: Invoke at the event tracking, report the information recorded by the game to the statistics module; It should be noted that the event lable must be assigned by SuperSDK, otherwise the report is invalid. After the integration is completed, confirm with the technical colleagues to verify whether the integration is correct.

Interface invoke:

Dictionary<String, Object> paramData = new Dictionary<String, Object>();
paramData.Add(SuperSDKStats.KEY_EVENT_ID, "11");//事件ID,需提前定义
paramData.Add(SuperSDKStats.KEY_EVENT_LABEL, "SuperSDK_ClientReport");//事件标签(topic),必须使用SuperSDK_ClientReport。
paramData.Add(SuperSDKStats.KEY_DESC, "enterGame");//事件描述,可不传
paramData.Add(SuperSDKStats.KEY_STACK, "");//堆栈信息,一般在发生异常时使用,传入异常堆栈信息

Dictionary<String, Object> extraMap = new Dictionary<String, Object>();
try {
	extraMap.Add("eventname", "clientreport");//当前的事件名称,当前支持clientreport
	extraMap.Add("channel_id", "");//CPS分包ID,手游需填
	extraMap.Add("client_ip", "");//客户端IP
	extraMap.Add("opid", "");//游族统一运营商ID,新标准中应为4位数字;
	extraMap.Add("opgameid", "");//混服组ID,如不能直接获取,默认使用server_id前4位
	extraMap.Add("server_id", "");//服务器ID,一般为10位数字,例如,2015311523
	extraMap.Add("server_type", "");//1:正式服,2:非正式服(包含各类测试服)
	extraMap.Add("account", "");//带SuperSDK前缀的userID
	extraMap.Add("account_register_time", "");//平台账号在平台首次注册的时间,10位Unix时间戳
	extraMap.Add("account_first_ingame_time", "");//平台账号在该游戏首次注册时间(所有游戏服里,第一个角色的注册时间),从平台接口获取,10位Unix时间戳(秒)
	extraMap.Add("role_id", "");
	extraMap.Add("role_name", "");
	extraMap.Add("level", "");
	extraMap.Add("vip_level", "");
	extraMap.Add("role_register_time", "");//角色注册时间,10位Unix时间戳(秒),例如,1479960346
	extraMap.Add("role_power", "");//战力,发送当前战力数,默认值0
	extraMap.Add("role_union_id", "");//成员团体的ID,如公会,部落、战队势力等。没有工会的默认发 '0'。
	extraMap.Add("role_paid", "");//如果该角色从未付过费,发送值0;如果付过费,发送值1
	extraMap.Add("role_type", "");//角色类型,标识角色的分类属性,1:正常 2:测试(不计入充值等统计) 3:GM/福利号 4:机器人 5:其它
	extraMap.Add("ad_user", "");//1:广告用户,2:非广告用户,默认为2。填数字,例如, '1',代表广告用户
	extraMap.Add("extra_event_id", "");	//事件id,根据事件类型,角色id,发生时间地点等来产生该 id。例如两个人对战,处于同一事件,共用一个事件ID;用两种资源一起兑换一个道具,两条消耗日志,使用同一个事件ID。
	extraMap.Add("loading_step", "");//加载步骤
	extraMap.Add("is_key_loading_step", "");	//是否必经步骤	1,是;0,否
	extraMap.Add("extra_1", "");	//扩展字段1
	extraMap.Add("extra_2", "");	//扩展字段2
	extraMap.Add("extra_3", "");	//扩展字段3
	extraMap.Add("extra_4", "");	//扩展字段4
	extraMap.Add("extra_5", "");	//扩展字段5
} catch (Exception e) {

}
paramData.Add(SuperSDKStats.KEY_EXTRA, extraMap);//扩展信息,游戏所有数据都可以通过这里传入,使用json格式。

SuperSDK.getInstance().Invoke(SuperSDKStats.MODULE_NAME, "reportCustomData", paramData);

Appendix

Constant String Actual String Description
SuperSDKStats.MODULE_NAME stats Module name
SuperSDKStats.FUNC_GET_DEVICE_INFO getDeviceInfo Module name
SuperSDKStats.FUNC_REPORT report Data report method name
SuperSDKStats.KEY_EVENT_ID event_id Event ID
SuperSDKStats.KEY_EVENT_LABEL event_label Event label
SuperSDKStats.KEY_DESC desc description
SuperSDKStats.KEY_STACK stack Stack information, used when an anomaly occurs
SuperSDKStats.KEY_EXTRA extra extra Information