fix: 修复打点发送的 target

Signed-off-by: huyufei <yufei.hu@castbox.fm>
胡宇飞 2024-08-07 17:55:06 +08:00
parent 61ff5027d4
commit 959677859c
4 changed files with 44 additions and 26 deletions

View File

@ -207,49 +207,46 @@ namespace Guru
// #1 ad_impression
Analytics.ADImpression(data.ToAdImpressionData());
// #2 tch_001
// #2 tch_001 + tch_02 广告点内 tch_001 和 tch_02 都需要计算
double revenue = data.value;
CalcTch001Value(revenue);
CalcTch02Value(revenue);
AddAdsTch001Revenue(revenue);
AddAdsTch02Revenue(revenue);
// #3 adjust_ad_revenue
AdjustService.Instance.TrackADRevenue(data.value, data.currency, data.adSource, data.adUnitId, data.networkPlacement);
}
/// <summary>
/// 计算太极001收益
/// 累积计算太极001收益
/// </summary>
/// <param name="revenue"></param>
private void CalcTch001Value(double revenue)
private void AddAdsTch001Revenue(double revenue)
{
TchAD001RevValue += revenue;
double revenueValue = TchAD001RevValue;
// Debug.Log($"{Tag} --- [Tch] get <TchAD001RevValue> totally: {revenueValue}");
if (revenueValue >= Analytics.Tch001TargetValue)
{
Debug.Log($"{Tag} --- [Tch] call <tch_ad_rev_roas_001> with value: {revenueValue}");
Analytics.Tch001ADRev(revenueValue);
TchAD001RevValue = 0.0;
}
if (revenueValue < Analytics.Tch001TargetValue) return;
Debug.Log($"{Tag} --- [Tch] call <tch_ad_rev_roas_001> with value: {revenueValue}");
Analytics.Tch001ADRev(revenueValue);
TchAD001RevValue = 0.0;
}
/// <summary>
/// 计算太极02收益
/// 累积计算太极02收益
/// </summary>
/// <param name="revenue"></param>
private void CalcTch02Value(double revenue)
private void AddAdsTch02Revenue(double revenue)
{
if (!Analytics.EnableTch02Event) return;
TchAD02RevValue += revenue;
double revenueValue = TchAD02RevValue;
Debug.Log($"[Ads] get <TchAD02RevValue> totally: {revenueValue}");
if (revenueValue >= Analytics.Tch02TargetValue)
{
Debug.Log($"[Ads] call <tch_ad_rev_roas_02> with value: {revenueValue}");
Analytics.Tch02ADRev(revenueValue);
TchAD02RevValue = 0.0;
}
if (revenueValue < Analytics.TCH_02_VALUE) return;
Debug.Log($"{Tag} --- [Tch] call <tch_ad_rev_roas_02> with value: {revenueValue}");
Analytics.Tch02ADRev(revenueValue);
TchAD02RevValue = 0.0;
}
#endregion

View File

@ -104,7 +104,7 @@ namespace Guru
public const string ATTOptIn = "att_opt_in";
public const string ATTOpOut = "att_opt_out";
public const string ParameterATTStatus = "att_status";
public const string EventATTResult = "att_result";
public const string EventAttResult = "att_result";
// 用户属性
public const string PropertyFirstOpenTime = "first_open_time"; //用户第一次first_open的时间

View File

@ -163,7 +163,7 @@ namespace Guru
TrackEvent(eventName, extra, new EventSetting()
{
EnableFirebaseAnalytics = true,
EnableFacebookAnalytics = true,
EnableGuruAnalytics = true,
EnableAdjustAnalytics = true
});
}
@ -266,6 +266,7 @@ namespace Guru
#region Tch 太极打点逻辑
public const double TCH_02_VALUE = 0.2; // tch_02 上限值
private static double _tch001MaxValue = 5.0d; // 预设保护值, 如果大于这个值, 算作异常上报
private static double _tch001TargetValue = 0.01d;
public static double Tch001TargetValue => _tch001TargetValue; // 太极 001 设定值
@ -387,7 +388,12 @@ namespace Guru
//--------- Extra data for IAP receipt ---------------
TrackEvent(evtName, data);
TrackEvent(evtName, data, new EventSetting()
{
EnableFirebaseAnalytics = true,
EnableGuruAnalytics = true,
EnableFacebookAnalytics = true,
});
}
@ -465,6 +471,10 @@ namespace Guru
{ ParameterAdPlatform, AdMAX },
{ ParameterCurrency, USD },
{ ParameterValue, value },
}, new EventSetting()
{
EnableFirebaseAnalytics = true,
EnableGuruAnalytics = true,
});
}
@ -561,6 +571,7 @@ namespace Guru
TrackEvent(EventIAPReturnTrue, dict, new EventSetting()
{
EnableFirebaseAnalytics = true,
EnableGuruAnalytics = true,
EnableAdjustAnalytics = true,
});
@ -662,6 +673,9 @@ namespace Guru
receipt = adata.receipt;
}
//---------- 太极打点逻辑 -----------
// tch_001 和 tch_02 都要上报
// fb 的 purchase 事件只打一次
// TCH 001
Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate, isTest);
@ -670,6 +684,8 @@ namespace Guru
// Facebook Track IAP Purchase
FBPurchase(usdPrice, USD, "iap", IAPPlatform);
//---------- 太极打点逻辑 -----------
if (orderData.orderType == 1)
{
@ -740,7 +756,12 @@ namespace Guru
};
// 上报Firebase + 自打点
TrackEvent(eventName, dict, new EventSetting() { EnableFirebaseAnalytics = true });
TrackEvent(eventName, dict, new EventSetting()
{
EnableFirebaseAnalytics = true,
EnableGuruAnalytics = true,
EnableAdjustAnalytics = true
});
// 上报 Adjust 支付事件
LogAdjustRevenueEvent(eventName, value, productId, orderId, purchaseToken, receipt, dict);

View File

@ -22,7 +22,7 @@ namespace Guru
public bool EnableFirebaseAnalytics;
public bool EnableAdjustAnalytics;
public bool EnableFacebookAnalytics;
public bool EnableGuruAnalytics;
public bool EnableGuruAnalytics = true; // 默认开启自打点
public override string ToString()
{