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; | ||||
| 
 | ||||
| namespace Guru | ||||
|  | @ -603,15 +604,19 @@ namespace Guru | |||
| 		/// </summary> | ||||
| 		/// <param name="productId"></param> | ||||
| 		/// <param name="usdPrice"></param> | ||||
| 		/// <param name="userCurrency"></param> | ||||
| 		/// <param name="payPrice"></param> | ||||
| 		/// <param name="orderId"></param> | ||||
| 		/// <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) | ||||
| 		/// <param name="orderData"></param> | ||||
| 		/// <param name="isTest"></param> | ||||
| 		public static void ReportIAPSuccessEvent(BaseOrderData orderData, double usdPrice, bool isTest = false) | ||||
| 		{ | ||||
| 			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; | ||||
| 			double payPrice = orderData.payPrice; | ||||
| 			string orderType = orderData.OrderType(); | ||||
|  | @ -631,12 +636,12 @@ namespace Guru | |||
| 			if (orderData.orderType == 1) | ||||
| 			{ | ||||
| 				// sub_pruchase : Firebase + Guru + Adjust | ||||
| 				SubPurchase(usdPrice, productId, orderId, orderDate); | ||||
| 				SubPurchase(usdPrice, productId, orderId, orderDate, isTest); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				// iap_purchase : Firebase + Guru + Adjust | ||||
| 				IAPPurchase(usdPrice, productId, orderId, orderDate); | ||||
| 				IAPPurchase(usdPrice, productId, orderId, orderDate, isTest); | ||||
| 			} | ||||
| 			 | ||||
| 			// IAP Ret true : Firebase + Guru + Adjust | ||||
|  | @ -655,18 +660,18 @@ namespace Guru | |||
| 		/// <param name="productId"></param> | ||||
| 		/// <param name="orderId"></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>() | ||||
| 			{ | ||||
|  | @ -676,7 +681,8 @@ namespace Guru | |||
| 				[ParameterProductId] = productId, | ||||
| 				["order_id"] = orderId, | ||||
| 				["order_type"] = orderType, | ||||
| 				["trans_ts"] = orderDate | ||||
| 				["trans_ts"] = orderDate, | ||||
| 				["sandbox"] = isSandbox? "true": "false" | ||||
| 			}, new EventSetting() | ||||
| 			{ | ||||
| 				EnableFirebaseAnalytics = true, | ||||
|  |  | |||
|  | @ -50,6 +50,7 @@ namespace Guru | |||
| 				{ | ||||
| 					GenDeviceId(); | ||||
| 				} | ||||
| 				 | ||||
| 				return SavedDeviceId; // 优先使用缓存的 DeviceID | ||||
| 			} | ||||
| 		} | ||||
|  |  | |||
|  | @ -34,19 +34,14 @@ namespace Guru | |||
|         { | ||||
|             try | ||||
|             { | ||||
|                 Debug.Log($"[IAP] --- Apple Order Response: {response}"); | ||||
|                 ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response); | ||||
|                 if (responseData != null && responseData.data != null) | ||||
|                 {  | ||||
|                    double usdPrice = responseData.data.usdPrice; | ||||
|                    string productId = orderData.productId; | ||||
|                     double usdPrice = responseData.data.usdPrice; | ||||
|                     bool isTest = responseData.data.test; | ||||
|                      | ||||
|                     // Analytics.Tch001IAPRev(usdPrice, productId, orderData.orderId, orderData.OrderType(), orderData.payedDate); | ||||
|                     // Analytics.Tch02IAPRev(usdPrice); | ||||
|                     // | ||||
|                     // AdjustService.TrackSubPurchase(usdPrice, productId); | ||||
|                     // Analytics.SubPurchase(usdPrice, productId); | ||||
|                      | ||||
|                     Analytics.ReportIAPSuccessEvent(usdPrice, productId, orderData); | ||||
|                     Analytics.ReportIAPSuccessEvent(orderData, usdPrice, isTest); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|  |  | |||
|  | @ -31,21 +31,14 @@ namespace Guru | |||
|         { | ||||
|             try | ||||
|             { | ||||
|                 Debug.Log($"[IAP] --- Google Order Response: {response}"); | ||||
|                 ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response); | ||||
|                 if (responseData != null && responseData.data != null) | ||||
|                 { | ||||
|                     double usdPrice = responseData.data.usdPrice; | ||||
|                     string productId = orderData.RealProductId; | ||||
|                     bool isTest = responseData.data.test; | ||||
|                      | ||||
|                     // Analytics.Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate); // TCH 001 | ||||
|                     // // 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); | ||||
|                     Analytics.ReportIAPSuccessEvent(orderData, usdPrice, isTest); | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|  |  | |||
|  | @ -6,10 +6,11 @@ namespace Guru | |||
|     public class OrderResponse | ||||
|     { | ||||
|         public double usdPrice; | ||||
|         public bool test; | ||||
|          | ||||
|         public override string ToString() | ||||
|         { | ||||
|             return $"{nameof(usdPrice)}: {usdPrice}"; | ||||
|             return $"{nameof(usdPrice)}: {usdPrice}  {nameof(test)}: {test}"; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue