parent
171e67ac77
commit
bb3a1310b3
|
|
@ -25,6 +25,9 @@ namespace Guru
|
||||||
public static readonly string EventIAPReturnTrue = "iap_ret_true";
|
public static readonly string EventIAPReturnTrue = "iap_ret_true";
|
||||||
public static readonly string EventIAPReturnFalse = "iap_ret_false";
|
public static readonly string EventIAPReturnFalse = "iap_ret_false";
|
||||||
|
|
||||||
|
// 关卡打点
|
||||||
|
public static readonly string EventLevelFirstEnd = "level_first_end";
|
||||||
|
|
||||||
//横幅广告打点事件
|
//横幅广告打点事件
|
||||||
public static readonly string EventBadsLoad = "bads_load";
|
public static readonly string EventBadsLoad = "bads_load";
|
||||||
public static readonly string EventBadsLoaded = "bads_loaded";
|
public static readonly string EventBadsLoaded = "bads_loaded";
|
||||||
|
|
|
||||||
|
|
@ -238,25 +238,24 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 第一次通关打点
|
/// 第一次通关打点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void LevelFirstEnd(string itemCategory, string itemID, string levelName, int level,
|
public static void LevelFirstEnd(string levelType, string levelName, int level,
|
||||||
ELevelResult result, int? duration = null, int? step = null, int? score = null)
|
string result, int? duration = null, Dictionary<string, object> extra = null)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<string, object>()
|
var dict = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, itemCategory },
|
{ ParameterItemCategory, levelType },
|
||||||
{ ParameterItemId, itemID },
|
|
||||||
{ ParameterLevelName, levelName },
|
{ ParameterLevelName, levelName },
|
||||||
{ ParameterLevel, level },
|
{ ParameterLevel, level },
|
||||||
{ ParameterSuccess, result == ELevelResult.success ? 1 : 0 },
|
{ ParameterSuccess, result == "success" ? 1 : 0 },
|
||||||
{ ParameterResult, result.ToString() },
|
{ ParameterResult, result },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (duration != null)
|
if (duration != null)
|
||||||
dict[ParameterDuration] = duration.Value;
|
dict[ParameterDuration] = duration.Value;
|
||||||
if(step != null)
|
if (extra != null)
|
||||||
dict[ParameterStep] = step.Value;
|
dict.AddRange(extra, isOverride: true);
|
||||||
if(score != null)
|
|
||||||
dict[ParameterScore] = score.Value;
|
LogEvent(EventLevelFirstEnd, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -604,6 +603,7 @@ namespace Guru
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, itemCategory },
|
{ ParameterItemCategory, itemCategory },
|
||||||
{ ParameterItemName, productID },
|
{ ParameterItemName, productID },
|
||||||
|
{ ParameterResult, failReason }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,22 @@ namespace Guru
|
||||||
|
|
||||||
public bool IsInitialized => _storeController != null && _storeExtensionProvider != null;
|
public bool IsInitialized => _storeController != null && _storeExtensionProvider != null;
|
||||||
|
|
||||||
private Product _curPurchasingProduct = null;
|
private ProductInfo _curProductInfo = null;
|
||||||
private string _curProductCategory = "";
|
private string _curProductCategory = "";
|
||||||
|
|
||||||
|
public string CurrentBuyingProductId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_curProductInfo != null)
|
||||||
|
{
|
||||||
|
return _curProductInfo.Id;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private IAPModel _model;
|
private IAPModel _model;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否是首次购买
|
/// 是否是首次购买
|
||||||
|
|
@ -532,11 +545,11 @@ namespace Guru
|
||||||
#endif
|
#endif
|
||||||
if (string.IsNullOrEmpty(category)) category = info.Category;
|
if (string.IsNullOrEmpty(category)) category = info.Category;
|
||||||
_storeController.InitiatePurchase(product);
|
_storeController.InitiatePurchase(product);
|
||||||
_curPurchasingProduct = product;
|
_curProductInfo = info;
|
||||||
_curProductCategory = category;
|
_curProductCategory = category;
|
||||||
|
|
||||||
Analytics.IAPClick(_curProductCategory, product.definition.id);
|
Analytics.IAPClick(_curProductCategory, product.definition.id);
|
||||||
Analytics.IAPImp(_curProductCategory, product.definition.id);
|
// Analytics.IAPImp(_curProductCategory, product.definition.id); // <--- Client should report this Event
|
||||||
|
|
||||||
OnBuyStart?.Invoke(productName);
|
OnBuyStart?.Invoke(productName);
|
||||||
return (T)this;
|
return (T)this;
|
||||||
|
|
@ -569,7 +582,7 @@ namespace Guru
|
||||||
SetIsIAPUser(success); // 设置用户属性标记
|
SetIsIAPUser(success); // 设置用户属性标记
|
||||||
|
|
||||||
// 只有实际发生购买后才会有订单上报. 启动时的 Restore 操作自动调用支付成功. 这里做一个判定, 过滤掉订单的物品
|
// 只有实际发生购买后才会有订单上报. 启动时的 Restore 操作自动调用支付成功. 这里做一个判定, 过滤掉订单的物品
|
||||||
if (_curPurchasingProduct != null)
|
if (_curProductInfo != null)
|
||||||
{
|
{
|
||||||
ReportPurchaseResult(purchaseEvent); // 订单上报
|
ReportPurchaseResult(purchaseEvent); // 订单上报
|
||||||
|
|
||||||
|
|
@ -619,14 +632,7 @@ namespace Guru
|
||||||
ProductInfo info = GetInfoById(productId);
|
ProductInfo info = GetInfoById(productId);
|
||||||
|
|
||||||
//上报点位,用户购买失败的原因
|
//上报点位,用户购买失败的原因
|
||||||
if (failureReason == PurchaseFailureReason.UserCancelled)
|
Analytics.IAPRetFalse(_curProductCategory, product.definition.id, failureReason.ToString());
|
||||||
{
|
|
||||||
Analytics.IAPClose(_curProductCategory, product.definition.id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Analytics.IAPRetFalse(_curProductCategory, product.definition.id, failureReason.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
LogI($"{Tag} --- OnPurchaseFailed :: failureReason = {failureReason}");
|
LogI($"{Tag} --- OnPurchaseFailed :: failureReason = {failureReason}");
|
||||||
// 失败的处理逻辑
|
// 失败的处理逻辑
|
||||||
|
|
@ -639,7 +645,7 @@ namespace Guru
|
||||||
|
|
||||||
private void ClearCurPurchasingProduct()
|
private void ClearCurPurchasingProduct()
|
||||||
{
|
{
|
||||||
_curPurchasingProduct = null;
|
_curProductInfo = null;
|
||||||
_curProductCategory = "";
|
_curProductCategory = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue