diff --git a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs
index 8273da0..50d32f2 100644
--- a/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs
+++ b/Runtime/GuruCore/Runtime/Adjust/AdjustService.cs
@@ -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
///
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);
+ }
+
+ ///
+ /// IAP订阅支付事件上报
+ ///
+ ///
+ ///
+ 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
diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs
index 1530e73..3801fa4 100644
--- a/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs
+++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.Const.cs
@@ -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";
diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs
index b9041d3..b80dae3 100644
--- a/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs
+++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.TemplateDefine.cs
@@ -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事件(请手动开启)
///
@@ -562,12 +571,18 @@ namespace Guru
///
///
///
- 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()
{
diff --git a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs
index 68e83c2..5562ca4 100644
--- a/Runtime/GuruCore/Runtime/Analytics/Analytics.cs
+++ b/Runtime/GuruCore/Runtime/Analytics/Analytics.cs
@@ -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;
diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs
index 26c5cdb..28299b7 100644
--- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs
+++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/AppleOrderRequest.cs
@@ -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);
diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs
index 68857be..1c6c173 100644
--- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs
+++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/GoogleOrderRequest.cs
@@ -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);
diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/ResponseData/OrderResponse.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/ResponseData/OrderResponse.cs
index 06aea14..0fb2f78 100644
--- a/Runtime/GuruCore/Runtime/IPM/Scripts/ResponseData/OrderResponse.cs
+++ b/Runtime/GuruCore/Runtime/IPM/Scripts/ResponseData/OrderResponse.cs
@@ -5,7 +5,7 @@ namespace Guru
[Serializable]
public class OrderResponse
{
- public float usdPrice;
+ public double usdPrice;
public override string ToString()
{