渠道统计 和 UV统计

项目中使用到了渠道统计 和 贷超点击(UV)统计,这里记录一下业务逻辑。

渠道统计

        在项目中定义了很多渠道,除了类似xiaomi,360等一些市场渠道,还有其他一些自定义的A1,B1,C1,other等渠道。项目中使用到了渠道统计,用于给数据分析团队使用。

        这边的逻辑是:用户安装app之后,第一次打开app时会上传渠道来源到我们的后台。

统计的依据是根据设备id。

具体代码:

        

/**
 * 检查是否需要提交渠道统计信息,需要则提交渠道来源
 */
private void channelCheck(){
    String channel = StringUtil.isBlank(DeviceSpUtil.getString(DeviceSpUtil.CHANNELIDKEY))?WalleChannelReader.getChannel(mContext,""):DeviceSpUtil.getString(DeviceSpUtil.CHANNELIDKEY);
    if(TextUtils.isEmpty(channel)){
        channel = "other";//如果没有取到具体的渠道值,就使用other
    }
    if(!DeviceSpUtil.getBoolean(DeviceSpUtil.HASCANLEREPORT,false)&&!StringUtil.isBlank(channel)){
        HashMap paramMap = new HashMap<>();
        paramMap.put("channelAbbr", channel);
        paramMap.put("uniqueId", DeviceUuidFactory.getDeviceUuid(mContext));
        new ChannelHelper().androidActivate(new RetrofitSubscriber>(new RetrofitInterface>() {
            @Override
            public void onNext(BaseRspBean booleanBaseRspBean) {
                DeviceSpUtil.putBoolean(DeviceSpUtil.HASCANLEREPORT,true);
            }

            @Override
            public void onError(int errorCode, String errorMsg) {

            }
        },mContext,false,false),paramMap);
    }
}

 

UV统计

        项目中接入了很多贷超产品。这个具体是按转化率来收钱的,所以有必要对贷超产品的点击量进行统计。

        具体实现:

                传参中有userId,loanMarketProductId这两个参数,后台统计贷超点击的次数:每天对同一个userId点击某一贷超,无论点击几次,都只记录一次。

你可能感兴趣的:(Android)