update: Tch 001 和 Tch 02 打点, 添加 sandbox 参数

Signed-off-by: huyufei <yufei.hu@castbox.fm>
main
胡宇飞 2024-06-26 16:17:23 +08:00
parent 2174bcf1a3
commit 1a9481b094
1 changed files with 12 additions and 7 deletions

View File

@ -296,9 +296,10 @@ namespace Guru
/// <param name="orderId"></param> /// <param name="orderId"></param>
/// <param name="orderType"></param> /// <param name="orderType"></param>
/// <param name="timestamp"></param> /// <param name="timestamp"></param>
public static void Tch001IAPRev(double value, string productId, string orderId, string orderType, string timestamp) /// <param name="isSandbox"></param>
public static void Tch001IAPRev(double value, string productId, string orderId, string orderType, string timestamp, bool isSandbox = false)
{ {
TchRevEvent(EventTchAdRev001Impression, IAPPlatform, value, orderType, productId, orderId, timestamp); TchRevEvent(EventTchAdRev001Impression, IAPPlatform, value, orderType, productId, orderId, timestamp, isSandbox? "true" : "false");
} }
/// <summary> /// <summary>
@ -310,11 +311,12 @@ namespace Guru
/// <param name="orderId"></param> /// <param name="orderId"></param>
/// <param name="orderType"></param> /// <param name="orderType"></param>
/// <param name="timestamp"></param> /// <param name="timestamp"></param>
/// <param name="isSandbox"></param>
// public static void Tch02IAPRev(double value, string productId, string orderId, string orderType, string timestamp) // public static void Tch02IAPRev(double value, string productId, string orderId, string orderType, string timestamp)
public static void Tch02IAPRev(double value, string productId, string orderId, string orderType, string timestamp) public static void Tch02IAPRev(double value, string productId, string orderId, string orderType, string timestamp, bool isSandbox = false)
{ {
if (!EnableTch02Event) return; if (!EnableTch02Event) return;
TchRevEvent(EventTchAdRev02Impression, IAPPlatform, value, orderType, productId, orderId, timestamp); TchRevEvent(EventTchAdRev02Impression, IAPPlatform, value, orderType, productId, orderId, timestamp, isSandbox? "true" : "false");
} }
/// <summary> /// <summary>
@ -363,8 +365,9 @@ namespace Guru
/// <param name="productId"></param> /// <param name="productId"></param>
/// <param name="orderId"></param> /// <param name="orderId"></param>
/// <param name="timestamp"></param> /// <param name="timestamp"></param>
/// <param name="sandbox"></param>
private static void TchRevEvent(string evtName, string platform, double value, private static void TchRevEvent(string evtName, string platform, double value,
string orderType = "", string productId = "", string orderId = "", string timestamp = "") string orderType = "", string productId = "", string orderId = "", string timestamp = "", string sandbox = "")
{ {
var data = new Dictionary<string, dynamic>() var data = new Dictionary<string, dynamic>()
{ {
@ -378,6 +381,8 @@ namespace Guru
if(!string.IsNullOrEmpty(productId)) data["product_id"] = productId; if(!string.IsNullOrEmpty(productId)) data["product_id"] = productId;
if(!string.IsNullOrEmpty(orderId)) data["order_id"] = orderId; if(!string.IsNullOrEmpty(orderId)) data["order_id"] = orderId;
if(!string.IsNullOrEmpty(timestamp)) data["trans_ts"] = timestamp; if(!string.IsNullOrEmpty(timestamp)) data["trans_ts"] = timestamp;
if(!string.IsNullOrEmpty(sandbox)) data["sandbox"] = sandbox;
//--------- Extra data for IAP receipt --------------- //--------- Extra data for IAP receipt ---------------
LogEvent(evtName, data); LogEvent(evtName, data);
@ -627,9 +632,9 @@ namespace Guru
bool isFree = orderData.isFree; bool isFree = orderData.isFree;
string offerId = orderData.offerId; string offerId = orderData.offerId;
// TCH 001 // TCH 001
Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate); Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate, isTest);
// TCH 020 // TCH 020
Tch02IAPRev(usdPrice, productId, orderId, orderType, orderDate); Tch02IAPRev(usdPrice, productId, orderId, orderType, orderDate, isTest);
// Facebook Track IAP Purchase // Facebook Track IAP Purchase
FBPurchase(usdPrice, USD, "iap", IAPPlatform); FBPurchase(usdPrice, USD, "iap", IAPPlatform);