update: 添加续订打点修改逻辑
--story=1020368 --user=yufei.hu 【中台】【IAP】续订打点修改逻辑 https://www.tapd.cn/33527076/s/1150863 Signed-off-by: huyufei <yufei.hu@castbox.fm>main
parent
ba90a32195
commit
c59f76aead
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Data.Odbc;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace Guru
|
namespace Guru
|
||||||
|
|
@ -603,15 +604,19 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="productId"></param>
|
/// <param name="productId"></param>
|
||||||
/// <param name="usdPrice"></param>
|
/// <param name="usdPrice"></param>
|
||||||
/// <param name="userCurrency"></param>
|
/// <param name="orderData"></param>
|
||||||
/// <param name="payPrice"></param>
|
/// <param name="isTest"></param>
|
||||||
/// <param name="orderId"></param>
|
public static void ReportIAPSuccessEvent(BaseOrderData orderData, double usdPrice, bool isTest = false)
|
||||||
/// <param name="orderType"></param>
|
|
||||||
/// <param name="orderDate"></param>
|
|
||||||
/// <param name="scene"></param>
|
|
||||||
/// <param name="isFree"></param>
|
|
||||||
public static void ReportIAPSuccessEvent(double usdPrice, string productId, BaseOrderData orderData)
|
|
||||||
{
|
{
|
||||||
|
if (orderData == null) return;
|
||||||
|
|
||||||
|
if (!isTest && usdPrice == 0)
|
||||||
|
{
|
||||||
|
Debug.Log($"[SDK] --- Pruchase value is 0, skip report orders");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string productId = orderData.productId;
|
||||||
string userCurrency = orderData.userCurrency;
|
string userCurrency = orderData.userCurrency;
|
||||||
double payPrice = orderData.payPrice;
|
double payPrice = orderData.payPrice;
|
||||||
string orderType = orderData.OrderType();
|
string orderType = orderData.OrderType();
|
||||||
|
|
@ -631,12 +636,12 @@ namespace Guru
|
||||||
if (orderData.orderType == 1)
|
if (orderData.orderType == 1)
|
||||||
{
|
{
|
||||||
// sub_pruchase : Firebase + Guru + Adjust
|
// sub_pruchase : Firebase + Guru + Adjust
|
||||||
SubPurchase(usdPrice, productId, orderId, orderDate);
|
SubPurchase(usdPrice, productId, orderId, orderDate, isTest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// iap_purchase : Firebase + Guru + Adjust
|
// iap_purchase : Firebase + Guru + Adjust
|
||||||
IAPPurchase(usdPrice, productId, orderId, orderDate);
|
IAPPurchase(usdPrice, productId, orderId, orderDate, isTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IAP Ret true : Firebase + Guru + Adjust
|
// IAP Ret true : Firebase + Guru + Adjust
|
||||||
|
|
@ -655,18 +660,18 @@ namespace Guru
|
||||||
/// <param name="productId"></param>
|
/// <param name="productId"></param>
|
||||||
/// <param name="orderId"></param>
|
/// <param name="orderId"></param>
|
||||||
/// <param name="orderDate"></param>
|
/// <param name="orderDate"></param>
|
||||||
public static void IAPPurchase(double value, string productId, string orderId, string orderDate)
|
public static void IAPPurchase(double value, string productId, string orderId, string orderDate, bool isSandbox = false)
|
||||||
{
|
{
|
||||||
IAPPurchaseReport(EventIAPPurchase, value, productId, orderId, "IAP", orderDate);
|
IAPPurchaseReport(EventIAPPurchase, value, productId, orderId, "IAP", orderDate, isSandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SubPurchase(double value, string productId, string orderId, string orderDate)
|
public static void SubPurchase(double value, string productId, string orderId, string orderDate, bool isSandbox = false)
|
||||||
{
|
{
|
||||||
IAPPurchaseReport(EventSubPurchase, value, productId, orderId, "SUB", orderDate);
|
IAPPurchaseReport(EventSubPurchase, value, productId, orderId, "SUB", orderDate, isSandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void IAPPurchaseReport(string eventName, double value, string productId, string orderId, string orderType, string orderDate)
|
private static void IAPPurchaseReport(string eventName, double value, string productId, string orderId, string orderType, string orderDate, bool isSandbox = false)
|
||||||
{
|
{
|
||||||
LogEvent(eventName, new Dictionary<string, dynamic>()
|
LogEvent(eventName, new Dictionary<string, dynamic>()
|
||||||
{
|
{
|
||||||
|
|
@ -676,7 +681,8 @@ namespace Guru
|
||||||
[ParameterProductId] = productId,
|
[ParameterProductId] = productId,
|
||||||
["order_id"] = orderId,
|
["order_id"] = orderId,
|
||||||
["order_type"] = orderType,
|
["order_type"] = orderType,
|
||||||
["trans_ts"] = orderDate
|
["trans_ts"] = orderDate,
|
||||||
|
["sandbox"] = isSandbox? "true": "false"
|
||||||
}, new EventSetting()
|
}, new EventSetting()
|
||||||
{
|
{
|
||||||
EnableFirebaseAnalytics = true,
|
EnableFirebaseAnalytics = true,
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ namespace Guru
|
||||||
{
|
{
|
||||||
GenDeviceId();
|
GenDeviceId();
|
||||||
}
|
}
|
||||||
|
|
||||||
return SavedDeviceId; // 优先使用缓存的 DeviceID
|
return SavedDeviceId; // 优先使用缓存的 DeviceID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,19 +34,14 @@ namespace Guru
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Debug.Log($"[IAP] --- Apple Order Response: {response}");
|
||||||
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
|
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
|
||||||
if (responseData != null && responseData.data != null)
|
if (responseData != null && responseData.data != null)
|
||||||
{
|
{
|
||||||
double usdPrice = responseData.data.usdPrice;
|
double usdPrice = responseData.data.usdPrice;
|
||||||
string productId = orderData.productId;
|
bool isTest = responseData.data.test;
|
||||||
|
|
||||||
// Analytics.Tch001IAPRev(usdPrice, productId, orderData.orderId, orderData.OrderType(), orderData.payedDate);
|
Analytics.ReportIAPSuccessEvent(orderData, usdPrice, isTest);
|
||||||
// Analytics.Tch02IAPRev(usdPrice);
|
|
||||||
//
|
|
||||||
// AdjustService.TrackSubPurchase(usdPrice, productId);
|
|
||||||
// Analytics.SubPurchase(usdPrice, productId);
|
|
||||||
|
|
||||||
Analytics.ReportIAPSuccessEvent(usdPrice, productId, orderData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,14 @@ namespace Guru
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Debug.Log($"[IAP] --- Google Order Response: {response}");
|
||||||
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
|
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
|
||||||
if (responseData != null && responseData.data != null)
|
if (responseData != null && responseData.data != null)
|
||||||
{
|
{
|
||||||
double usdPrice = responseData.data.usdPrice;
|
double usdPrice = responseData.data.usdPrice;
|
||||||
string productId = orderData.RealProductId;
|
bool isTest = responseData.data.test;
|
||||||
|
|
||||||
// Analytics.Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate); // TCH 001
|
Analytics.ReportIAPSuccessEvent(orderData, usdPrice, isTest);
|
||||||
// // Analytics.Tch02IAPRev(usdPrice, productId, orderId, orderTypeString, timestamp);
|
|
||||||
// Analytics.Tch02IAPRev(usdPrice); // TCH 020
|
|
||||||
//
|
|
||||||
// // Adjust Track IAP Purchase
|
|
||||||
// AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件
|
|
||||||
// Analytics.IAPPurchase(usdPrice, productId);
|
|
||||||
|
|
||||||
Analytics.ReportIAPSuccessEvent(usdPrice, productId, orderData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,11 @@ namespace Guru
|
||||||
public class OrderResponse
|
public class OrderResponse
|
||||||
{
|
{
|
||||||
public double usdPrice;
|
public double usdPrice;
|
||||||
|
public bool test;
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"{nameof(usdPrice)}: {usdPrice}";
|
return $"{nameof(usdPrice)}: {usdPrice} {nameof(test)}: {test}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue