From 6f85752093d1c1f8a04932281d4d7b57577f670d Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 18 Jul 2023 15:06:30 +0800 Subject: [PATCH 1/9] =?UTF-8?q?firebase=E3=80=81af=E3=80=81fb=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 354 +++++++++++++++++++++ lua/app/common/data_manager.lua | 12 +- lua/app/common/pay_manager.lua | 4 + lua/app/common/sdk_manager.lua | 8 +- lua/app/module/chapter/chapter_manager.lua | 9 + lua/app/module/login/login_manager.lua | 4 + lua/app/module/summon/summon_manager.lua | 7 + lua/app/userdata/hero/hero_data.lua | 5 + lua/app/userdata/player/player_data.lua | 12 + 9 files changed, 413 insertions(+), 2 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 69dc89aa..effd86b0 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -429,6 +429,356 @@ function BIReport:postFirstLoginEvent() CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_first_login", json.encode({})) end +-- 上报广告播放提升事件,单独处理,只上报到AF和FB,不上报数数 +function BIReport:postAdEvent() + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + local adCount = DataManager.PlayerData:getAdCount() + if not adCount then + return + end + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({})) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({})) + local afPostAdCount = { + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [20] = true, + [40] = true, + [80] = true, + } + if afPostAdCount[adCount] then + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args)) + end + + local fbPostAdCount = { + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [20] = true, + } + if fbPostAdCount[adCount] then + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args)) + end +end + +-- 上报进入章节事件,单独处理,只上报到AF和FB,不上报数数 +function BIReport:postChapterEvent(chapter) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + if not chapter then + return + end + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({})) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({})) + local postChapter = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + [5] = true, + [6] = true, + [7] = true, + [8] = true, + [9] = true, + [10] = true, + [11] = true, + [12] = true, + [13] = true, + [14] = true, + [15] = true, + [16] = true, + [17] = true, + [18] = true, + [19] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + } + if postChapter[chapter] then + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args)) + end + + local fbPostChapter = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + [5] = true, + [6] = true, + [7] = true, + [8] = true, + [9] = true, + [10] = true, + [15] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + } + + if fbPostChapter[chapter] then + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args)) + end +end + +-- 上报获取任意x个英雄 +function BIReport:postFirstGetHero(num) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + local postHeroNum = { + [4] = true, + [6] = true, + [8] = true, + [10] = true, + [12] = true, + [14] = true, + [16] = true, + [18] = true, + [20] = true, + } + if not postHeroNum[num] then + return + end + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_herosum_" .. num, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_herosum_" .. num, json.encode(args)) +end + +-- 上报英雄等级 +function BIReport:postHeroLev(beforeLv, lv) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + + local allHeroes = DataManager.HeroData:getAllHeroes() + local postHeroLevel = { + [3] = true, + [5] = true, + [7] = true, + [9] = true + } + local temp = {} + for heroid, heroEntity in pairs(allHeroes) do + for heroLv, _ in pairs(postHeroLevel) do + if heroEntity:getLv() >= heroLv then + temp[heroLv] = (temp[heroLv] or 0) + 1 + end + end + end + for heroLv, count in pairs(temp) do + if heroLv > beforeLv and heroLv <= lv and count == 5 then + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_hero4_lev" .. heroLv, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_hero4_lev" .. heroLv, json.encode(args)) + end + end +end + +-- 上报等级提升事件,单独处理,只上报到AF和FB,不上报数数 +function BIReport:postLvEvent(lv) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + if not lv then + return + end + local postLV = { + [1] = true, + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [15] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + [60] = true, + [70] = true, + [80] = true, + } + -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({})) + -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({})) + if not postLV[lv] then + return + end + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade_" .. lv, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade_" .. lv, json.encode(args)) +end + +-- 上报部分档位首次付费 +function BIReport:postFirstRechargeEvent(id) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + local postRechargeID = { + [1] = false, -- 0.99 + [2] = false, -- 1.99 + [3] = true, -- 2.99 + [4] = false, -- 3.99 + [5] = true, -- 4.99 + [6] = false, -- 5.99 + [7] = false, -- 6.99 + [8] = false, -- 7.99 + [9] = false, -- 8.99 + [10] = true, -- 9.99 + [11] = false, -- 11.99 + [12] = false, -- 14.99 + [13] = true, -- 19.99 + [14] = false, -- 24.99 + [15] = true, -- 29.99 + [16] = true, -- 49.99 + [17] = false, -- 69.99 + [18] = false, -- 99.99 + [19] = false, -- 199.99 + } + if not postRechargeID[id] then + return + end + local cfg = ConfigManager:getConfig("recharge")[id] + if not cfg then + return + end + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_package_" .. cfg.price, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_package_" .. cfg.price, json.encode(args)) +end + +-- 上报24小时内部分章节第一次失败的用户 +function BIReport:post24GradeFailEvent(chapterId) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + if not DataManager:getIsInCreate24Hour() then + return + end + local postChapterId = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + } + if not postChapterId[chapterId] then + return + end + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_24_grade_" .. chapterId .. "_fail", json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_24_grade_" .. chapterId .. "_fail", json.encode(args)) +end + +-- 上报24小时内部分英雄升级 +function BIReport:post24HeroLevel(heroId) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + if not DataManager:getIsInCreate24Hour() then + return + end + local heroEntity = DataManager.HeroData:getHeroById(heroId) + if not heroEntity or heroEntity:getLv() > 2 then + return + end + local postHeroId = { + [22001] = "24_blade_levelup", + [32001] = "24_onion_levelup", + [42001] = "24_iceheart_levelup", + } + if not postHeroId[heroId] then + return + end + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. postHeroId[heroId], json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. postHeroId[heroId], json.encode(args)) +end + +-- 上报24小时内开宝箱 +function BIReport:post24OpenBox(count) + -- 只有外网正式渠道真机包才上报 + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + -- 审核/白名单模式不上报 + if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then + return + end + if not DataManager:getIsInCreate24Hour() then + return + end + local postCount = { + [3] = true + } + if not postCount[count] then + return + end + + local args = {} + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_24_boxopen_3", json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_24_boxopen_3", json.encode(args)) +end + +-- Firebase +function BIReport:postFirebaseLog(eventName, eventValue) + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + if not eventName or not eventValue then + return + end + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostFireBaseEvent(eventName, json.encode(eventValue)) +end + -- 以下为数数 function BIReport:printArgsStr(eventName, args) if not EDITOR_MODE then @@ -1045,6 +1395,10 @@ function BIReport:postAppLovinAdRevenue(msg) self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) if args.revenue and args.network_name and args.ad_unit_identifier and args.placement then self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement) + local args = { + applovin_revenue = args.revenue + } + self:postFirebaseLog("ad_impression", args) end end diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 243f3be7..50304d59 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -125,6 +125,8 @@ function DataManager:initWithServerData(data) Logger.logHighlight("initWithServerData") Logger.printTable(data) end + self.registerTs = data.stat and data.stat.register_ts or Time:getServerTime() + self.registerTs = GFunc.formatTimeStep(self.registerTs or Time:getServerTime()) self.todayFirstLogin = data.today_first_login self.PlayerData:init(data) self.ChapterData:init(data.chapter) @@ -175,12 +177,20 @@ end -- 是否首次登录 function DataManager:getIsFirstLogin() local nowTime = Time:getServerTime() - if self.registerTs%86400 == nowTime %8640 and self:getIsTodayFirstLogin() then + local offset = nowTime - (self.registerTs or 0) + if math.abs(offset) <= 10 and self:getIsTodayFirstLogin() then -- 允许误差 return true end return false end +-- 是否在新号24小时内 +function DataManager:getIsInCreate24Hour() + local nowTime = Time:getServerTime() + local passTime = nowTime - (self.registerTs or 0) + return passTime < 86400 +end + function DataManager:getIsTodayFirstLogin() return self.todayFirstLogin or false end diff --git a/lua/app/common/pay_manager.lua b/lua/app/common/pay_manager.lua index bab2d912..a35e5cf7 100644 --- a/lua/app/common/pay_manager.lua +++ b/lua/app/common/pay_manager.lua @@ -175,6 +175,7 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type] local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id] local rechargeId = cfgInfo.recharge_id + local beforCount = DataManager.PlayerData:getPayCounts(rechargeId) DataManager.PlayerData:addPayment(rechargeId) DataManager.ShopData:addPayment(rechargeId) -- 降档版本 DataManager.ShopData:updateGiftInfo(gift) @@ -183,6 +184,9 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc giftId = gift.id, rechargeId = cfgInfo.recharge_id }) + if beforCount <= 0 then + BIReport:postFirstRechargeEvent(rechargeId) + end end) for _, info in ipairs(biPayGetInfo) do diff --git a/lua/app/common/sdk_manager.lua b/lua/app/common/sdk_manager.lua index 76aa0089..b2c0bc4d 100644 --- a/lua/app/common/sdk_manager.lua +++ b/lua/app/common/sdk_manager.lua @@ -301,6 +301,12 @@ function SDKManager:showFullScreenAds(adsClickType, adCallback) BIReport:postAdClick(adsClickType) if EDITOR_MODE then + if DataManager.PlayerData then + DataManager.PlayerData:addAdCount() + local data = {} + data.ads_num = DataManager.PlayerData:getAdCount() + CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data) + end self:adRewradAd() if adCallback then adCallback() @@ -364,7 +370,7 @@ end function SDKManager:adRewradAd(noReport) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_WATCH_AD) if not noReport then - -- BIReport:postAdEvent() + BIReport:postAdEvent() end end diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index b78ace71..5597f48b 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -58,6 +58,12 @@ function ChapterManager:startFightFinish(result) end ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE, params) + -- 上报FB AF章节 + local chapterId = DataManager.ChapterData:getChapterId() + if result.reqData.chapter_id then + chapterId = result.reqData.chapter_id + end + BIReport:postChapterEvent(chapterId) end end @@ -162,6 +168,9 @@ function ChapterManager:endFightFinish(result) if not reqData.win then DataManager.ShopData:markPopLastChapterActGift() + if DataManager.ChapterData:getChapterFightCount(fightChapterId) == 1 then -- 首次失败上报 + BIReport:post24GradeFailEvent(fightChapterId) + end end ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat) diff --git a/lua/app/module/login/login_manager.lua b/lua/app/module/login/login_manager.lua index d32ad686..d668a48a 100644 --- a/lua/app/module/login/login_manager.lua +++ b/lua/app/module/login/login_manager.lua @@ -173,6 +173,10 @@ function LoginManager:loginFinish(data) local info = LocalData:getLastLoginInfo() BIReport:postAccountLoginFinish(info.type) + + if DataManager:getIsFirstLogin() then + BIReport:postLvEvent(1) + end else local info = LocalData:getLastLoginInfo() BIReport:postAccountLoginFailed(info.type, data.err_code) diff --git a/lua/app/module/summon/summon_manager.lua b/lua/app/module/summon/summon_manager.lua index 710a7eb0..0c297cf0 100644 --- a/lua/app/module/summon/summon_manager.lua +++ b/lua/app/module/summon/summon_manager.lua @@ -41,6 +41,13 @@ function SummonManager:summonFinish(result) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_OPEN_SHOP_BOX_LEVEL_3, 1) end end + if result.summon_info.count then + local totalCount = 0 + for t, count in pairs(result.summon_info.count) do + totalCount = totalCount + count + end + BIReport:post24OpenBox(totalCount) + end end end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 7d77350f..779aed14 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -127,7 +127,9 @@ function HeroData:setHeroLv(id, lv) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT) ModuleManager.PlayerManager:checkUnlockAvatar(id) activeBefore = false + BIReport:postFirstGetHero(self.data.activeCount) end + local beforeLv = entity:getLv() entity:setLv(lv) if entity:isActived() then local matchType = entity:getMatchType() @@ -145,6 +147,9 @@ function HeroData:setHeroLv(id, lv) end BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE) end + + BIReport:postHeroLev(beforeLv, lv) + BIReport:post24HeroLevel(id) end function HeroData:getMatchActiveHeroMap() diff --git a/lua/app/userdata/player/player_data.lua b/lua/app/userdata/player/player_data.lua index 4edb4812..6799f1bd 100644 --- a/lua/app/userdata/player/player_data.lua +++ b/lua/app/userdata/player/player_data.lua @@ -18,6 +18,8 @@ function PlayerData:init(data) self.data.payAmount = 0 self.data.payCount = 0 self.data.adCount = stat.ad_count or 0 + self.pay_counts = stat.pay_counts or {} + self.register_ts = GFunc.formatTimeStep(stat.register_ts or Time:getServerTime()) if stat.pay_counts then for id, count in pairs(stat.pay_counts) do if RECHARGE_CFG[id] then @@ -128,6 +130,7 @@ function PlayerData:setLv(level, exp) local data = {} data.player_level = self.data.level CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data) + BIReport:postLvEvent(level) end function PlayerData:getLv() @@ -191,12 +194,17 @@ function PlayerData:addPayment(rechargeId) local cfg = ConfigManager:getConfig("recharge")[rechargeId] self.data.payAmount = self.data.payAmount + cfg.price self.data.payCount = self.data.payCount + 1 + self.pay_counts[rechargeId] = (self.pay_counts[rechargeId] or 0) + 1 end function PlayerData:getPayCount() return self.data.payCount end +function PlayerData:getPayCounts(rechargeId) + return self.pay_counts[rechargeId] or 0 +end + function PlayerData:addPayCount() self.data.payCount = self.data.payCount + 1 end @@ -563,4 +571,8 @@ function PlayerData:addArenaTicketAdBuyCount() self.data.arenaTicketADCount = self.data.arenaTicketADCount + 1 end +function PlayerData:getRegisterTs() + return self.register_ts or Time:getServerTime() +end + return PlayerData \ No newline at end of file From ed400f1b75f4f0de529daad4f7e4680b0ff0964b Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 18 Jul 2023 15:28:22 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E8=B7=A8=E7=AD=89=E7=BA=A7=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 17 ++++++++++++----- lua/app/module/login/login_manager.lua | 2 +- lua/app/userdata/player/player_data.lua | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index effd86b0..c698678e 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -606,7 +606,7 @@ function BIReport:postHeroLev(beforeLv, lv) end -- 上报等级提升事件,单独处理,只上报到AF和FB,不上报数数 -function BIReport:postLvEvent(lv) +function BIReport:postLvEvent(beforeLv, nowLv) -- 只有外网正式渠道真机包才上报 if not Platform:getIsPublishChannel() or EDITOR_MODE then return @@ -615,7 +615,7 @@ function BIReport:postLvEvent(lv) if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then return end - if not lv then + if not nowLv then return end local postLV = { @@ -635,12 +635,19 @@ function BIReport:postLvEvent(lv) } -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({})) -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({})) - if not postLV[lv] then + local reportLv + for lv, _ in pairs(postLV) do + if beforeLv < lv and nowLv >= lv then + reportLv = lv + break + end + end + if not reportLv then return end local args = {} - CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade_" .. lv, json.encode(args)) - CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade_" .. lv, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade_" .. reportLv, json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade_" .. reportLv, json.encode(args)) end -- 上报部分档位首次付费 diff --git a/lua/app/module/login/login_manager.lua b/lua/app/module/login/login_manager.lua index d668a48a..739c48f8 100644 --- a/lua/app/module/login/login_manager.lua +++ b/lua/app/module/login/login_manager.lua @@ -175,7 +175,7 @@ function LoginManager:loginFinish(data) BIReport:postAccountLoginFinish(info.type) if DataManager:getIsFirstLogin() then - BIReport:postLvEvent(1) + BIReport:postLvEvent(0, 1) end else local info = LocalData:getLastLoginInfo() diff --git a/lua/app/userdata/player/player_data.lua b/lua/app/userdata/player/player_data.lua index 6799f1bd..ffaafe8a 100644 --- a/lua/app/userdata/player/player_data.lua +++ b/lua/app/userdata/player/player_data.lua @@ -122,6 +122,7 @@ function PlayerData:addExp(exp) end function PlayerData:setLv(level, exp) + local beforeLv = self.data.level or 0 self.data.level = level self.data.exp = exp self.lvUpNeedExp = self:getNextExp(self.data.level) @@ -130,7 +131,7 @@ function PlayerData:setLv(level, exp) local data = {} data.player_level = self.data.level CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data) - BIReport:postLvEvent(level) + BIReport:postLvEvent(beforeLv, level) end function PlayerData:getLv() From a2ca40f00ccf82f0327bfe19a8b1b8d8b1254952 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 18 Jul 2023 15:35:49 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 307 +++++++++++++++++++---------------- 1 file changed, 169 insertions(+), 138 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index c698678e..6812da4f 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -445,28 +445,34 @@ function BIReport:postAdEvent() end CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({})) CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({})) - local afPostAdCount = { - [2] = true, - [3] = true, - [5] = true, - [10] = true, - [20] = true, - [40] = true, - [80] = true, - } - if afPostAdCount[adCount] then + if not self.afPostAdCount then + self.afPostAdCount = { + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [20] = true, + [40] = true, + [80] = true, + } + end + + if self.afPostAdCount[adCount] then local args = {} CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args)) end - local fbPostAdCount = { - [2] = true, - [3] = true, - [5] = true, - [10] = true, - [20] = true, - } - if fbPostAdCount[adCount] then + if not self.fbPostAdCount then + self.fbPostAdCount = { + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [20] = true, + } + end + + if self.fbPostAdCount[adCount] then local args = {} CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args)) end @@ -487,55 +493,59 @@ function BIReport:postChapterEvent(chapter) end CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({})) CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({})) - local postChapter = { - [1] = true, - [2] = true, - [3] = true, - [4] = true, - [5] = true, - [6] = true, - [7] = true, - [8] = true, - [9] = true, - [10] = true, - [11] = true, - [12] = true, - [13] = true, - [14] = true, - [15] = true, - [16] = true, - [17] = true, - [18] = true, - [19] = true, - [20] = true, - [30] = true, - [40] = true, - [50] = true, - } - if postChapter[chapter] then + if not self.afPostChapter then + self.afPostChapter = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + [5] = true, + [6] = true, + [7] = true, + [8] = true, + [9] = true, + [10] = true, + [11] = true, + [12] = true, + [13] = true, + [14] = true, + [15] = true, + [16] = true, + [17] = true, + [18] = true, + [19] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + } + end + if self.afPostChapter[chapter] then local args = {} CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args)) end - local fbPostChapter = { - [1] = true, - [2] = true, - [3] = true, - [4] = true, - [5] = true, - [6] = true, - [7] = true, - [8] = true, - [9] = true, - [10] = true, - [15] = true, - [20] = true, - [30] = true, - [40] = true, - [50] = true, - } + if not self.fbPostChapter then + self.fbPostChapter = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + [5] = true, + [6] = true, + [7] = true, + [8] = true, + [9] = true, + [10] = true, + [15] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + } + end - if fbPostChapter[chapter] then + if self.fbPostChapter[chapter] then local args = {} CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args)) end @@ -551,18 +561,21 @@ function BIReport:postFirstGetHero(num) if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then return end - local postHeroNum = { - [4] = true, - [6] = true, - [8] = true, - [10] = true, - [12] = true, - [14] = true, - [16] = true, - [18] = true, - [20] = true, - } - if not postHeroNum[num] then + if not self.postHeroNum then + self.postHeroNum = { + [4] = true, + [6] = true, + [8] = true, + [10] = true, + [12] = true, + [14] = true, + [16] = true, + [18] = true, + [20] = true, + } + end + + if not self.postHeroNum[num] then return end local args = {} @@ -582,15 +595,18 @@ function BIReport:postHeroLev(beforeLv, lv) end local allHeroes = DataManager.HeroData:getAllHeroes() - local postHeroLevel = { - [3] = true, - [5] = true, - [7] = true, - [9] = true - } + if not self.postHeroLevel then + self.postHeroLevel = { + [3] = true, + [5] = true, + [7] = true, + [9] = true + } + end + local temp = {} for heroid, heroEntity in pairs(allHeroes) do - for heroLv, _ in pairs(postHeroLevel) do + for heroLv, _ in pairs(self.postHeroLevel) do if heroEntity:getLv() >= heroLv then temp[heroLv] = (temp[heroLv] or 0) + 1 end @@ -618,25 +634,28 @@ function BIReport:postLvEvent(beforeLv, nowLv) if not nowLv then return end - local postLV = { - [1] = true, - [2] = true, - [3] = true, - [5] = true, - [10] = true, - [15] = true, - [20] = true, - [30] = true, - [40] = true, - [50] = true, - [60] = true, - [70] = true, - [80] = true, - } + if not self.postLV then + self.postLV = { + [1] = true, + [2] = true, + [3] = true, + [5] = true, + [10] = true, + [15] = true, + [20] = true, + [30] = true, + [40] = true, + [50] = true, + [60] = true, + [70] = true, + [80] = true, + } + end + -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({})) -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({})) local reportLv - for lv, _ in pairs(postLV) do + for lv, _ in pairs(self.postLV) do if beforeLv < lv and nowLv >= lv then reportLv = lv break @@ -660,28 +679,31 @@ function BIReport:postFirstRechargeEvent(id) if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then return end - local postRechargeID = { - [1] = false, -- 0.99 - [2] = false, -- 1.99 - [3] = true, -- 2.99 - [4] = false, -- 3.99 - [5] = true, -- 4.99 - [6] = false, -- 5.99 - [7] = false, -- 6.99 - [8] = false, -- 7.99 - [9] = false, -- 8.99 - [10] = true, -- 9.99 - [11] = false, -- 11.99 - [12] = false, -- 14.99 - [13] = true, -- 19.99 - [14] = false, -- 24.99 - [15] = true, -- 29.99 - [16] = true, -- 49.99 - [17] = false, -- 69.99 - [18] = false, -- 99.99 - [19] = false, -- 199.99 - } - if not postRechargeID[id] then + if not self.postRechargeID then + self.postRechargeID = { + [1] = false, -- 0.99 + [2] = false, -- 1.99 + [3] = true, -- 2.99 + [4] = false, -- 3.99 + [5] = true, -- 4.99 + [6] = false, -- 5.99 + [7] = false, -- 6.99 + [8] = false, -- 7.99 + [9] = false, -- 8.99 + [10] = true, -- 9.99 + [11] = false, -- 11.99 + [12] = false, -- 14.99 + [13] = true, -- 19.99 + [14] = false, -- 24.99 + [15] = true, -- 29.99 + [16] = true, -- 49.99 + [17] = false, -- 69.99 + [18] = false, -- 99.99 + [19] = false, -- 199.99 + } + end + + if not self.postRechargeID[id] then return end local cfg = ConfigManager:getConfig("recharge")[id] @@ -706,13 +728,16 @@ function BIReport:post24GradeFailEvent(chapterId) if not DataManager:getIsInCreate24Hour() then return end - local postChapterId = { - [1] = true, - [2] = true, - [3] = true, - [4] = true, - } - if not postChapterId[chapterId] then + if not self.postChapterId then + self.postChapterId = { + [1] = true, + [2] = true, + [3] = true, + [4] = true, + } + end + + if not self.postChapterId[chapterId] then return end local args = {} @@ -737,17 +762,20 @@ function BIReport:post24HeroLevel(heroId) if not heroEntity or heroEntity:getLv() > 2 then return end - local postHeroId = { - [22001] = "24_blade_levelup", - [32001] = "24_onion_levelup", - [42001] = "24_iceheart_levelup", - } - if not postHeroId[heroId] then + if not self.postHeroId then + self.postHeroId = { + [22001] = "24_blade_levelup", + [32001] = "24_onion_levelup", + [42001] = "24_iceheart_levelup", + } + end + + if not self.postHeroId[heroId] then return end local args = {} - CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. postHeroId[heroId], json.encode(args)) - CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. postHeroId[heroId], json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. self.postHeroId[heroId], json.encode(args)) + CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. self.postHeroId[heroId], json.encode(args)) end -- 上报24小时内开宝箱 @@ -763,10 +791,13 @@ function BIReport:post24OpenBox(count) if not DataManager:getIsInCreate24Hour() then return end - local postCount = { - [3] = true - } - if not postCount[count] then + if not self.postBoxCount then + self.postBoxCount = { + [3] = true + } + end + + if not self.postBoxCount[count] then return end From fe73554226c5e45b90d1fe8048503cea247edfe2 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 18 Jul 2023 16:36:26 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 6812da4f..de527519 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -733,7 +733,7 @@ function BIReport:post24GradeFailEvent(chapterId) [1] = true, [2] = true, [3] = true, - [4] = true, + [5] = true, } end From c3e62e4bc2138c5392b813b54e8e10ceb6534318 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 18 Jul 2023 17:04:09 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 6 +++--- lua/app/module/chapter/chapter_manager.lua | 2 +- lua/app/module/summon/summon_manager.lua | 2 +- lua/app/userdata/hero/hero_data.lua | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index de527519..7ebfd284 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -716,7 +716,7 @@ function BIReport:postFirstRechargeEvent(id) end -- 上报24小时内部分章节第一次失败的用户 -function BIReport:post24GradeFailEvent(chapterId) +function BIReport:postFirstDayGradeFailEvent(chapterId) -- 只有外网正式渠道真机包才上报 if not Platform:getIsPublishChannel() or EDITOR_MODE then return @@ -746,7 +746,7 @@ function BIReport:post24GradeFailEvent(chapterId) end -- 上报24小时内部分英雄升级 -function BIReport:post24HeroLevel(heroId) +function BIReport:postFirstDayHeroLevel(heroId) -- 只有外网正式渠道真机包才上报 if not Platform:getIsPublishChannel() or EDITOR_MODE then return @@ -779,7 +779,7 @@ function BIReport:post24HeroLevel(heroId) end -- 上报24小时内开宝箱 -function BIReport:post24OpenBox(count) +function BIReport:postFirstDayOpenBox(count) -- 只有外网正式渠道真机包才上报 if not Platform:getIsPublishChannel() or EDITOR_MODE then return diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index 5597f48b..fe69d241 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -169,7 +169,7 @@ function ChapterManager:endFightFinish(result) if not reqData.win then DataManager.ShopData:markPopLastChapterActGift() if DataManager.ChapterData:getChapterFightCount(fightChapterId) == 1 then -- 首次失败上报 - BIReport:post24GradeFailEvent(fightChapterId) + BIReport:postFirstDayGradeFailEvent(fightChapterId) end end diff --git a/lua/app/module/summon/summon_manager.lua b/lua/app/module/summon/summon_manager.lua index 0c297cf0..73fde500 100644 --- a/lua/app/module/summon/summon_manager.lua +++ b/lua/app/module/summon/summon_manager.lua @@ -46,7 +46,7 @@ function SummonManager:summonFinish(result) for t, count in pairs(result.summon_info.count) do totalCount = totalCount + count end - BIReport:post24OpenBox(totalCount) + BIReport:postFirstDayOpenBox(totalCount) end end end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 779aed14..d25bb5e0 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -149,7 +149,7 @@ function HeroData:setHeroLv(id, lv) end BIReport:postHeroLev(beforeLv, lv) - BIReport:post24HeroLevel(id) + BIReport:postFirstDayHeroLevel(id) end function HeroData:getMatchActiveHeroMap() From e20311211e93d15430e44ccfe6957a963699f63f Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Jul 2023 09:49:49 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BB=B7=E5=80=BC?= =?UTF-8?q?=E5=9B=9E=E4=BC=A0=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 18 ++++++++++++++++++ lua/app/common/sdk_manager.lua | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 6cc55ab9..88327055 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -257,6 +257,7 @@ local EVENT_NAME_PAY_UI_SHOW = "client_pay_ui_show" -- 内购相关界面展示 local EVENT_NAME_BOUNTY_OPT = "client_bounty_opt" -- 通用战令事件(包括常规,竞技场等) local EVENT_NAME_NETWORK_OPT = "client_network_opt" -- 网络操作 local EVENT_NAME_APPLOVIN_AD_REVENUE = "client_applovin_ad_revenue" -- applovin广告收入 +local EVENT_NAME_IRONSOURCE_AD_REVENUE = "client_ironsource_ad_revenue" -- applovin广告收入 local EVENT_NAME_DAILY_CHALLENGE_OPT = "client_daily_challenge_opt" local EVENT_NAME_ARENA_OPT = "client_arena_opt"-- 竞技场 local EVENT_NAME_MISCELLANEOUS_OPT = "event_name_miscellaneous_opt" -- 一些杂项 @@ -1441,6 +1442,23 @@ function BIReport:postAppLovinAdRevenue(msg) end end +function BIReport:postIronSourceAdRevenue(msg) + local args = json.decode(msg) or {} + if args.revenue then + args.revenue = tonumber(args.revenue) + end + if args.lifetime_revenue then + args.lifetime_revenue = tonumber(args.lifetime_revenue) + end + self:report(EVENT_NAME_IRONSOURCE_AD_REVENUE, args) + if args.revenue then + local args2 = { + ironsource_revenue = args.revenue + } + self:postFirebaseLog("ad_impression", args2) + end +end + -- 竞技场进入消耗上报 function BIReport:postArenaConsume(gradingId, todayConsume) local args = { diff --git a/lua/app/common/sdk_manager.lua b/lua/app/common/sdk_manager.lua index b2c0bc4d..2c370bd4 100644 --- a/lua/app/common/sdk_manager.lua +++ b/lua/app/common/sdk_manager.lua @@ -275,6 +275,11 @@ function SDKManager:initAdsListener() self.adCallback = nil end end) + CS.BF.BFMain.Instance.SDKMgr.BFIronSourceSDKMgr:SetAdRevenuePaidEventCallback(function (result) + if result and result ~= GConst.EMPTY_STRING then + BIReport:postIronSourceAdRevenue(result) + end + end) elseif CS.UnityEngine.Application.platform == CS.UnityEngine.RuntimePlatform.IPhonePlayer then -- 初始化一下 local adManager = CS.AdManager.Instance From c643750a33485e0515157e1b99583ec211463171 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Jul 2023 11:29:43 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BB=B7=E5=80=BC?= =?UTF-8?q?=E5=9B=9E=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 88327055..d5dc8339 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -808,6 +808,18 @@ function BIReport:postFirstDayOpenBox(count) CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_24_boxopen_3", json.encode(args)) end +-- AF广告价值回传 +function BIReport:logAppsFlyerAdRevenue(mediationNetwork, monetizationNetwork, eventRevenue, data) + if not Platform:getIsPublishChannel() or EDITOR_MODE then + return + end + if not mediationNetwork or not monetizationNetwork or not eventRevenue then + return + end + local jsonStr = data and json.encode(data) or "{}" + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:LogAppsFlyerAdRevenue(mediationNetwork, monetizationNetwork, eventRevenue, jsonStr) +end + -- Firebase function BIReport:postFirebaseLog(eventName, eventValue) if not Platform:getIsPublishChannel() or EDITOR_MODE then @@ -1435,10 +1447,11 @@ function BIReport:postAppLovinAdRevenue(msg) self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) if args.revenue and args.network_name and args.ad_unit_identifier and args.placement then self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement) - local args = { + local args2 = { applovin_revenue = args.revenue } - self:postFirebaseLog("ad_impression", args) + self:postFirebaseLog("ad_impression", args2) + self:logAppsFlyerAdRevenue(3, args.network_name, args.revenue, args) end end @@ -1456,6 +1469,7 @@ function BIReport:postIronSourceAdRevenue(msg) ironsource_revenue = args.revenue } self:postFirebaseLog("ad_impression", args2) + self:logAppsFlyerAdRevenue(2, args.network_name, args.revenue, args) end end From dad792f0af7e336043c63a7ed4cbe4bd58feccaa Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Jul 2023 14:59:25 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96AF=E5=B9=BF?= =?UTF-8?q?=E5=91=8A=E5=9B=9E=E4=BC=A0sdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/sdk_manager.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/app/common/sdk_manager.lua b/lua/app/common/sdk_manager.lua index 2c370bd4..4dd60c1a 100644 --- a/lua/app/common/sdk_manager.lua +++ b/lua/app/common/sdk_manager.lua @@ -68,6 +68,8 @@ function SDKManager:init() local SDKMgr = CS.BF.BFMain.Instance.SDKMgr self:initPay() self:initPayListener() + -- 初始化AF的广告回传SDK + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:InitAppsFlyerAdRevenue() self:initAdsListener() -- 拿到firebasetoken From a2e2370d29b816113e5505419e2a2d1c8d710510 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 19 Jul 2023 15:36:40 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/bi_report.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index d5dc8339..4c91ed98 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -1444,14 +1444,17 @@ function BIReport:postAppLovinAdRevenue(msg) if args.revenue then args.revenue = tonumber(args.revenue) end - self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) - if args.revenue and args.network_name and args.ad_unit_identifier and args.placement then - self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement) + if args.revenue then + if args.network_name and args.ad_unit_identifier and args.placement then + self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement) + end local args2 = { applovin_revenue = args.revenue } self:postFirebaseLog("ad_impression", args2) self:logAppsFlyerAdRevenue(3, args.network_name, args.revenue, args) + -- 最后上报数数,因为数数会给args里面增加一些字段 + self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) end end @@ -1463,13 +1466,14 @@ function BIReport:postIronSourceAdRevenue(msg) if args.lifetime_revenue then args.lifetime_revenue = tonumber(args.lifetime_revenue) end - self:report(EVENT_NAME_IRONSOURCE_AD_REVENUE, args) if args.revenue then local args2 = { ironsource_revenue = args.revenue } self:postFirebaseLog("ad_impression", args2) self:logAppsFlyerAdRevenue(2, args.network_name, args.revenue, args) + -- 最后上报数数,因为数数会给args里面增加一些字段 + self:report(EVENT_NAME_IRONSOURCE_AD_REVENUE, args) end end