update: 更新 Adjust 订阅上报接口
							parent
							
								
									6a59816453
								
							
						
					
					
						commit
						29478301a4
					
				|  | @ -10,10 +10,14 @@ namespace Guru | |||
| 	 | ||||
| 	public static class AdjustService | ||||
| 	{ | ||||
| 		public const string Version = "1.5.0"; | ||||
| 		public const string Version = "1.6.0"; | ||||
| 		public static readonly string LOG_TAG = "Adjust"; | ||||
| 		public static readonly float DelayTime = 1f; // 延迟启动时间 | ||||
| 
 | ||||
| 		public const string K_IAP_PURCHASE = "iap_purchase"; // 固定点位事件 | ||||
| 		public const string K_SUB_PURCHASE = "sub_purchase"; // 固定点位事件 | ||||
| 		 | ||||
| 
 | ||||
| 		private static string _adId = ""; | ||||
| 		public static string AdId | ||||
| 		{ | ||||
|  | @ -322,18 +326,32 @@ namespace Guru | |||
| 		/// <param name="productID"></param> | ||||
| 		public static void TrackIAPPurchase(double revenue, string productID) | ||||
| 		{ | ||||
| 			string tokenID = Analytics.GetAdjustEventToken("iap_purchase"); | ||||
| 			string tokenID = Analytics.GetAdjustEventToken(K_IAP_PURCHASE); | ||||
| 			if (string.IsNullOrEmpty(tokenID)) | ||||
| 				return; | ||||
| 			 | ||||
| #if UNITY_IOS | ||||
| 			string platform = "appstore";  | ||||
| #else | ||||
| 			string platform = "google_play"; | ||||
| #endif | ||||
| 			AdjustEvent adjustEvent = new AdjustEvent(tokenID); | ||||
| 			adjustEvent.setRevenue(revenue,"USD"); | ||||
| 			adjustEvent.AddEventParameter("platform", platform); | ||||
| 			adjustEvent.AddEventParameter("platform", Analytics.IAPPlatform); | ||||
| 			adjustEvent.AddEventParameter("product_id", productID); | ||||
| 			adjustEvent.AddEventParameter("value", $"{revenue}"); | ||||
| 			Adjust.trackEvent(adjustEvent); | ||||
| 		} | ||||
| 		 | ||||
| 		/// <summary> | ||||
| 		/// IAP订阅支付事件上报 | ||||
| 		/// </summary> | ||||
| 		/// <param name="revenue"></param> | ||||
| 		/// <param name="productID"></param> | ||||
| 		public static void TrackSubPurchase(double revenue, string productID) | ||||
| 		{ | ||||
| 			string tokenID = Analytics.GetAdjustEventToken(K_SUB_PURCHASE); | ||||
| 			if (string.IsNullOrEmpty(tokenID)) | ||||
| 				return; | ||||
| 
 | ||||
| 			AdjustEvent adjustEvent = new AdjustEvent(tokenID); | ||||
| 			adjustEvent.setRevenue(revenue,"USD"); | ||||
| 			adjustEvent.AddEventParameter("platform", Analytics.IAPPlatform); | ||||
| 			adjustEvent.AddEventParameter("product_id", productID); | ||||
| 			adjustEvent.AddEventParameter("value", $"{revenue}"); | ||||
| 			Adjust.trackEvent(adjustEvent); | ||||
|  | @ -356,6 +374,9 @@ namespace Guru | |||
| 			Adjust.trackAdRevenue(adRevenue); | ||||
| 		} | ||||
| 		 | ||||
| 		 | ||||
| 		 | ||||
| 		 | ||||
| 
 | ||||
| 		#endregion | ||||
| 
 | ||||
|  |  | |||
|  | @ -57,6 +57,7 @@ namespace Guru | |||
| 		 | ||||
| 		//内购成功事件上报 | ||||
| 		public static readonly string EventIAPPurchase = "iap_purchase"; | ||||
| 		public static readonly string EventSubPurchase = "sub_purchase"; | ||||
| 		public static readonly string IAPStoreCategory = "Store"; | ||||
| 		public static readonly string IAPTypeProduct = "product"; | ||||
| 		public static readonly string IAPTypeSubscription = "subscription"; | ||||
|  |  | |||
|  | @ -296,8 +296,17 @@ namespace Guru | |||
| 	     | ||||
| 	    private static double _tch02TargetValue = 0.20d; | ||||
| 	    public static double Tch02TargetValue => _tch02TargetValue; // 太极 02 设定值 | ||||
| 	     | ||||
| 	    private static string IAPPlatform => Application.platform == RuntimePlatform.IPhonePlayer ? "appstore" : "google_play"; | ||||
| 
 | ||||
| 	    public static string IAPPlatform | ||||
| 	    { | ||||
| 		    get | ||||
| 		    { | ||||
| #if UNITY_IOS | ||||
| 			    return "appstore"; | ||||
| #endif | ||||
| 			    return "google_play"; | ||||
| 		    } | ||||
| 	    } | ||||
| 	    public static bool EnableTch02Event { get; set; } = false; // 是否使用太极02事件(请手动开启) | ||||
| 	     | ||||
| 	    /// <summary> | ||||
|  | @ -562,12 +571,18 @@ namespace Guru | |||
| 		/// </summary> | ||||
| 		/// <param name="value"></param> | ||||
| 		/// <param name="productId"></param> | ||||
| 		public static void IAPPurchase(float value, string productId) | ||||
| 		public static void IAPPurchase(double value, string productId) | ||||
| 		{ | ||||
| 			IAPPurchaseReport(EventIAPPurchase, value, productId); | ||||
| 		} | ||||
| 		 | ||||
| 		public static void SubPurchase(double value, string productId) | ||||
| 		{ | ||||
| 			IAPPurchaseReport(EventSubPurchase, value, productId); | ||||
| 		} | ||||
| 		 | ||||
| 
 | ||||
| 		private static void IAPPurchaseReport(string eventName, float value, string productId) | ||||
| 		private static void IAPPurchaseReport(string eventName, double value, string productId) | ||||
| 		{ | ||||
| 			LogEvent(eventName, new Dictionary<string, dynamic>() | ||||
| 			{ | ||||
|  |  | |||
|  | @ -11,9 +11,9 @@ namespace Guru | |||
| 	{ | ||||
| 		public class EventSetting | ||||
| 		{ | ||||
| 			public bool EnableFirebaseAnalytics; | ||||
| 			public bool EnableAdjustAnalytics; | ||||
| 			public bool EnableFacebookAnalytics; | ||||
| 			public bool EnableFirebaseAnalytics = false; | ||||
| 			public bool EnableAdjustAnalytics = false; | ||||
| 			public bool EnableFacebookAnalytics = false; | ||||
| 		} | ||||
| 
 | ||||
| 		private static EventSetting _defaultEventSetting; | ||||
|  |  | |||
|  | @ -42,7 +42,7 @@ namespace Guru | |||
|             if (responseData != null && responseData.data != null) | ||||
|             { | ||||
|                 // Analytics.Tch001IAPRev(responseData.data.usdPrice); | ||||
|                 float usdPrice = responseData.data.usdPrice; | ||||
|                 double usdPrice = responseData.data.usdPrice; | ||||
|                 Analytics.Tch001IAPRev(usdPrice); | ||||
|                 Analytics.Tch02IAPRev(usdPrice); | ||||
|                 AdjustService.TrackIAPPurchase(usdPrice, productId); | ||||
|  |  | |||
|  | @ -48,7 +48,7 @@ namespace Guru | |||
|             if (responseData != null && responseData.data != null) | ||||
|             { | ||||
|                 // Analytics.Tch001IAPRev(responseData.data.usdPrice); | ||||
|                 float usdPrice = responseData.data.usdPrice; | ||||
|                 double usdPrice = responseData.data.usdPrice; | ||||
|                 Analytics.Tch001IAPRev(usdPrice); | ||||
|                 Analytics.Tch02IAPRev(usdPrice); | ||||
|                 AdjustService.TrackIAPPurchase(usdPrice, productId); | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ namespace Guru | |||
|     [Serializable] | ||||
|     public class OrderResponse | ||||
|     { | ||||
|         public float usdPrice; | ||||
|         public double usdPrice; | ||||
|          | ||||
|         public override string ToString() | ||||
|         { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue