update: 更新 Facebook 服务打点逻辑, 放置调用报空
Signed-off-by: huyufei <yufei.hu@castbox.fm>deeplink
parent
df75e0e2d1
commit
b728102800
|
|
@ -106,7 +106,7 @@ namespace Guru
|
||||||
LogEvent(EventEarnVirtualCurrency, data, new EventSetting() { EnableFirebaseAnalytics = true });
|
LogEvent(EventEarnVirtualCurrency, data, new EventSetting() { EnableFirebaseAnalytics = true });
|
||||||
|
|
||||||
// FB 上报收入点
|
// FB 上报收入点
|
||||||
FB.LogAppEvent(EventEarnVirtualCurrency, value, data);
|
FBService.LogEvent(EventEarnVirtualCurrency, value, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ namespace Guru
|
||||||
LogEvent(EventSpendVirtualCurrency, data, new EventSetting() { EnableFirebaseAnalytics = true });
|
LogEvent(EventSpendVirtualCurrency, data, new EventSetting() { EnableFirebaseAnalytics = true });
|
||||||
|
|
||||||
// FB 上报消费点
|
// FB 上报消费点
|
||||||
FB.LogAppEvent(EventSpendVirtualCurrency, value, data);
|
FBService.LogEvent(EventSpendVirtualCurrency, value, data);
|
||||||
// FB 上报消耗事件买量点
|
// FB 上报消耗事件买量点
|
||||||
FBSpentCredits(value, itemName, category); // 点位信息有变化
|
FBSpentCredits(value, itemName, category); // 点位信息有变化
|
||||||
}
|
}
|
||||||
|
|
@ -148,7 +148,7 @@ namespace Guru
|
||||||
/// <param name="contentType"></param>
|
/// <param name="contentType"></param>
|
||||||
private static void FBSpentCredits(int amount, string contentId, string contentType)
|
private static void FBSpentCredits(int amount, string contentId, string contentType)
|
||||||
{
|
{
|
||||||
FB.LogAppEvent(AppEventName.SpentCredits, amount,
|
FBService.LogEvent(AppEventName.SpentCredits, amount,
|
||||||
new Dictionary<string, object>()
|
new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ AppEventParameterName.ContentID, contentId },
|
{ AppEventParameterName.ContentID, contentId },
|
||||||
|
|
|
||||||
|
|
@ -467,9 +467,9 @@ namespace Guru
|
||||||
/// <param name="currency"></param>
|
/// <param name="currency"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="platfrom"></param>
|
/// <param name="platfrom"></param>
|
||||||
public static void FBPurchase(decimal revenue, string currency, string type, string platfrom)
|
public static void FBPurchase(float revenue, string currency, string type, string platfrom)
|
||||||
{
|
{
|
||||||
FB.LogPurchase(revenue, currency, new Dictionary<string, object>()
|
FBService.LogPurchase(revenue, currency, new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ AppEventParameterName.Currency, USD },
|
{ AppEventParameterName.Currency, USD },
|
||||||
{ AppEventParameterName.ContentType, type },
|
{ AppEventParameterName.ContentType, type },
|
||||||
|
|
@ -485,7 +485,7 @@ namespace Guru
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <param name="platfrom"></param>
|
/// <param name="platfrom"></param>
|
||||||
public static void FBPurchase(double value, string currency, string type, string platfrom)
|
public static void FBPurchase(double value, string currency, string type, string platfrom)
|
||||||
=> FBPurchase(Convert.ToDecimal(value), currency, type, platfrom);
|
=> FBPurchase(value, currency, type, platfrom);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Google ARO买量点
|
/// Google ARO买量点
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ namespace Guru
|
||||||
|
|
||||||
if (eventSetting.EnableFacebookAnalytics)
|
if (eventSetting.EnableFacebookAnalytics)
|
||||||
{
|
{
|
||||||
FB.LogAppEvent(eventName);
|
FBService.LogEvent(eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,7 +230,7 @@ namespace Guru
|
||||||
|
|
||||||
if (eventSetting.EnableFacebookAnalytics)
|
if (eventSetting.EnableFacebookAnalytics)
|
||||||
{
|
{
|
||||||
FB.LogAppEvent(eventName, null, dict);
|
FBService.LogEvent(eventName, null, dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,5 +54,46 @@ namespace Guru
|
||||||
Time.timeScale = 1;
|
Time.timeScale = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 事件上报
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="eventName"></param>
|
||||||
|
/// <param name="valueToSum"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
public static void LogEvent(string eventName, float? valueToSum = null, Dictionary<string, object> data = null)
|
||||||
|
{
|
||||||
|
if(!IsAvailable) return;
|
||||||
|
FB.LogAppEvent(eventName, valueToSum, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 支付上报
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="valueToSum"></param>
|
||||||
|
/// <param name="currency"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
public static void LogPurchase(float valueToSum, string currency = "USD",
|
||||||
|
Dictionary<string, object> data = null)
|
||||||
|
{
|
||||||
|
if(!IsAvailable) return;
|
||||||
|
FB.LogPurchase(valueToSum, currency, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static bool IsAvailable
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!FB.IsInitialized)
|
||||||
|
{
|
||||||
|
Debug.LogError("[FB] FB is not initialized, please call <FBService.StartService> first.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue