update: 更新打点参数和打点库逻辑
--story=1020273 --user=yufei.hu 【中台】【BI】 中台打点标准化, 更新原有的打点和用户属性上报逻辑 https://www.tapd.cn/33527076/s/1147487 Signed-off-by: huyufei <yufei.hu@castbox.fm>hotfix/v1.0.12.2
parent
7babe561b0
commit
beb027bf76
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Guru;
|
using Guru;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
@ -198,9 +199,10 @@ namespace Guru
|
||||||
/// 广告ARO收益打点
|
/// 广告ARO收益打点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="adInfo"></param>
|
/// <param name="adInfo"></param>
|
||||||
private void OnAdImpression(MaxSdkBase.AdInfo adInfo)
|
/// <param name="platform"></param>
|
||||||
|
private void OnAdImpression(MaxSdkBase.AdInfo adInfo, string platform = "")
|
||||||
{
|
{
|
||||||
Analytics.ADImpression(adInfo);
|
Analytics.ADImpression(adInfo, platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -250,6 +252,10 @@ namespace Guru
|
||||||
protected float _badsloadStartTime = 0;
|
protected float _badsloadStartTime = 0;
|
||||||
private bool _bannerVisible = false;
|
private bool _bannerVisible = false;
|
||||||
public bool IsBannerVisible => _bannerVisible;
|
public bool IsBannerVisible => _bannerVisible;
|
||||||
|
private int _badsloadedNum = 0;
|
||||||
|
private int _badsLoadFailNum = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int GetAdsLoadDuration(ref float startTime)
|
private int GetAdsLoadDuration(ref float startTime)
|
||||||
{
|
{
|
||||||
|
|
@ -320,9 +326,14 @@ namespace Guru
|
||||||
string adUnitId = GetBannerID();
|
string adUnitId = GetBannerID();
|
||||||
MaxSdk.ShowBanner(adUnitId);
|
MaxSdk.ShowBanner(adUnitId);
|
||||||
MaxSdk.SetBannerBackgroundColor(adUnitId, _backColor);
|
MaxSdk.SetBannerBackgroundColor(adUnitId, _backColor);
|
||||||
OnBannerImpEvent(adUnitId);
|
|
||||||
SetBannerAutoRefresh(true, adUnitId);
|
SetBannerAutoRefresh(true, adUnitId);
|
||||||
_bannerVisible = true;
|
if (!_bannerVisible)
|
||||||
|
{
|
||||||
|
_bannerVisible = true;
|
||||||
|
OnBannerImpEvent(adUnitId);
|
||||||
|
_badsloadedNum = 0;
|
||||||
|
_badsLoadFailNum = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -330,9 +341,14 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void HideBanner()
|
public virtual void HideBanner()
|
||||||
{
|
{
|
||||||
MaxSdk.HideBanner(GetBannerID());
|
string adUnitId = GetBannerID();
|
||||||
SetBannerAutoRefresh(true, GetBannerID());
|
MaxSdk.HideBanner(adUnitId);
|
||||||
_bannerVisible = false;
|
SetBannerAutoRefresh(false, adUnitId);
|
||||||
|
if (_bannerVisible)
|
||||||
|
{
|
||||||
|
_bannerVisible = false;
|
||||||
|
OnBannerHideEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -346,14 +362,16 @@ namespace Guru
|
||||||
|
|
||||||
private void OnBannerLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
private void OnBannerLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
|
||||||
{
|
{
|
||||||
// Analytics.ADBadsLoaded(adUnitId, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory);
|
_badsloadedNum++;
|
||||||
Analytics.ADBadsLoaded(AdParams.Build(adUnitId, adInfo,
|
// --- fixed by Yufei 2024-5-29 为 don't report bads_loaded any more. ---
|
||||||
duration: GetAdsLoadDuration(ref _badsloadStartTime), category: _badsCategory));
|
// Analytics.ADBadsLoaded(AdParams.Build(adUnitId, adInfo,
|
||||||
|
// duration: GetAdsLoadDuration(ref _badsloadStartTime), category: _badsCategory));
|
||||||
OnBadsLoaded();
|
OnBadsLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBannerFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
private void OnBannerFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
|
||||||
{
|
{
|
||||||
|
_badsLoadFailNum ++;
|
||||||
// Analytics.ADBadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory);
|
// Analytics.ADBadsFailed(adUnitId, (int)errorInfo.Code, GetAdsLoadDuration(ref _badsloadStartTime), _badsCategory);
|
||||||
Analytics.ADBadsFailed(AdParams.Build(adUnitId,
|
Analytics.ADBadsFailed(AdParams.Build(adUnitId,
|
||||||
duration: GetAdsLoadDuration(ref _badsloadStartTime), category: _badsCategory,
|
duration: GetAdsLoadDuration(ref _badsloadStartTime), category: _badsCategory,
|
||||||
|
|
@ -373,6 +391,12 @@ namespace Guru
|
||||||
Analytics.ADBadsImp(AdParams.Build(adUnitId, category: _badsCategory));
|
Analytics.ADBadsImp(AdParams.Build(adUnitId, category: _badsCategory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void OnBannerHideEvent()
|
||||||
|
{
|
||||||
|
Analytics.ADBadsHide(_badsloadedNum, _badsLoadFailNum);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Banner 收益打点
|
/// Banner 收益打点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -21,22 +21,37 @@ namespace Guru
|
||||||
|
|
||||||
#region Ads
|
#region Ads
|
||||||
|
|
||||||
private static Dictionary<string, object> BuildAdEventData(AdParams adParams)
|
private static Dictionary<string, object> BuildAdEventData(AdParams adParams, Dictionary<string, object> extra = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(adParams.category)) adParams.category = DefaultCategory;
|
if (string.IsNullOrEmpty(adParams.category))
|
||||||
if (string.IsNullOrEmpty(adParams.waterfallName)) adParams.waterfallName = DefaultWaterfall;
|
adParams.category = DefaultCategory;
|
||||||
|
if (string.IsNullOrEmpty(adParams.waterfallName))
|
||||||
|
adParams.waterfallName = DefaultWaterfall;
|
||||||
|
|
||||||
var data = new Dictionary<string, object>()
|
var data = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, adParams.category },
|
{ ParameterItemCategory, adParams.category },
|
||||||
{ ParameterItemName, adParams.adUnitId },
|
{ ParameterItemName, adParams.adUnitId },
|
||||||
{ ParameterNetworkName, adParams.networkName },
|
|
||||||
{ ParameterNetworkPlacement, adParams.networkPlacement },
|
|
||||||
{ ParameterWaterfall, adParams.waterfallName },
|
|
||||||
{ ParameterDuration, adParams.duration },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (adParams.errorCode != 0) data[ParameterErrorCode] = adParams.errorCode;
|
if (adParams.duration > 0)
|
||||||
|
data[ParameterDuration] = adParams.duration;
|
||||||
|
if (adParams.errorCode != 0)
|
||||||
|
data[ParameterErrorCode] = adParams.errorCode;
|
||||||
|
if (!string.IsNullOrEmpty(adParams.networkName))
|
||||||
|
data[ParameterNetworkName] = adParams.networkName;
|
||||||
|
if (!string.IsNullOrEmpty(adParams.networkPlacement))
|
||||||
|
data[ParameterNetworkPlacement] = adParams.networkPlacement;
|
||||||
|
if (!string.IsNullOrEmpty(adParams.waterfallName))
|
||||||
|
data[ParameterWaterfall] = adParams.waterfallName;
|
||||||
|
|
||||||
|
if (extra != null && extra.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var k in extra.Keys)
|
||||||
|
{
|
||||||
|
data[k] = extra[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +81,15 @@ namespace Guru
|
||||||
LogEvent(EventBadsImp, BuildAdEventData(adParams));
|
LogEvent(EventBadsImp, BuildAdEventData(adParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ADBadsHide( int loadedTimes, int failTimes)
|
||||||
|
{
|
||||||
|
var dict = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["loaded_times"] = loadedTimes,
|
||||||
|
["fail_times"] = failTimes
|
||||||
|
};
|
||||||
|
LogEvent(EventBadsHide, dict);
|
||||||
|
}
|
||||||
//---------------------- INTERSTITIAL -------------------------
|
//---------------------- INTERSTITIAL -------------------------
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 广告拉取
|
/// 广告拉取
|
||||||
|
|
@ -205,12 +229,13 @@ namespace Guru
|
||||||
{
|
{
|
||||||
SetAttProperty(status);
|
SetAttProperty(status);
|
||||||
Debug.Log($"{TAG} AttResult: {status} type:{type} others:{others}");
|
Debug.Log($"{TAG} AttResult: {status} type:{type} others:{others}");
|
||||||
LogEvent(EventATTResult, new Dictionary<string, dynamic>()
|
var dict = new Dictionary<string, dynamic>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, status },
|
{ ParameterItemCategory, status },
|
||||||
{ "type", type },
|
{ "type", type }
|
||||||
{ ParameterItemName, others },
|
};
|
||||||
});
|
if(!string.IsNullOrEmpty(others)) dict[ParameterItemName] = others;
|
||||||
|
LogEvent(EventATTResult, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ namespace Guru
|
||||||
public static readonly string EventBadsFailed = "bads_failed";
|
public static readonly string EventBadsFailed = "bads_failed";
|
||||||
public static readonly string EventBadsClick = "bads_clk";
|
public static readonly string EventBadsClick = "bads_clk";
|
||||||
public static readonly string EventBadsImp = "bads_imp";
|
public static readonly string EventBadsImp = "bads_imp";
|
||||||
|
public static readonly string EventBadsHide = "bads_hide";
|
||||||
|
|
||||||
//插屏广告打点事件
|
//插屏广告打点事件
|
||||||
public static readonly string EventIadsLoad = "iads_load";
|
public static readonly string EventIadsLoad = "iads_load";
|
||||||
|
|
|
||||||
|
|
@ -1,207 +1,108 @@
|
||||||
namespace Guru
|
namespace Guru
|
||||||
{
|
{
|
||||||
using Firebase.Analytics;
|
|
||||||
|
|
||||||
//https://firebase.google.com/docs/reference/cpp/group/parameter-names
|
//https://firebase.google.com/docs/reference/cpp/group/parameter-names
|
||||||
//Firebase内置定义事件名称和参数名称
|
//Firebase内置定义事件名称和参数名称
|
||||||
public static partial class Analytics
|
public static partial class Analytics
|
||||||
{
|
{
|
||||||
private static string EventAdImpression =>
|
internal static readonly string EventAdImpression = "ad_impression";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAdImpression : "ad_impression";
|
internal static readonly string EventAddPaymentInfo = "add_payment_info";
|
||||||
private static string EventAddPaymentInfo =>
|
internal static readonly string EventAddShippingInfo = "add_shipping_info";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAddPaymentInfo : "add_payment_info";
|
internal static readonly string EventAddToCart = "add_to_cart";
|
||||||
private static string EventAddShippingInfo =>
|
internal static readonly string EventAddToWishlist = "add_to_wishlist";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAddShippingInfo : "add_shipping_info";
|
internal static readonly string EventAppOpen = "app_open";
|
||||||
private static string EventAddToCart =>
|
internal static readonly string EventBeginCheckout = "begin_checkout";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAddToCart : "add_to_cart";
|
internal static readonly string EventCampaignDetails = "campaign_details";
|
||||||
private static string EventAddToWishlist =>
|
internal static readonly string EventEarnVirtualCurrency = "earn_virtual_currency";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAddToWishlist : "add_to_wishlist";
|
internal static readonly string EventGenerateLead = "generate_lead";
|
||||||
private static string EventAppOpen =>
|
internal static readonly string EventJoinGroup = "join_group";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventAppOpen : "app_open";
|
internal static readonly string EventLevelEnd = "level_end";
|
||||||
private static string EventBeginCheckout =>
|
internal static readonly string EventLevelStart = "level_start";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventBeginCheckout : "begin_checkout";
|
internal static readonly string EventLevelUp = "level_up";
|
||||||
private static string EventCampaignDetails =>
|
internal static readonly string EventLogin = "login";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventCampaignDetails : "campaign_details";
|
internal static readonly string EventPostScore = "post_score";
|
||||||
private static string EventEarnVirtualCurrency =>
|
internal static readonly string EventPurchase = "purchase";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventEarnVirtualCurrency : "earn_virtual_currency";
|
internal static readonly string EventRefund = "refund";
|
||||||
private static string EventGenerateLead =>
|
internal static readonly string EventRemoveFromCart = "remove_from_cart";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventGenerateLead : "generate_lead";
|
internal static readonly string EventScreenView = "screen_view";
|
||||||
private static string EventJoinGroup =>
|
internal static readonly string EventSearch = "search";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventJoinGroup : "join_group";
|
internal static readonly string EventSelectContent = "select_content";
|
||||||
private static string EventLevelEnd =>
|
internal static readonly string EventSelectItem = "select_item";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventLevelEnd : "level_end";
|
internal static readonly string EventSelectPromotion = "select_promotion";
|
||||||
private static string EventLevelStart =>
|
internal static readonly string EventShare = "share";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventLevelStart : "level_start";
|
internal static readonly string EventSignUp = "sign_up";
|
||||||
private static string EventLevelUp =>
|
internal static readonly string EventSpendVirtualCurrency = "spend_virtual_currency";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventLevelUp : "level_up";
|
internal static readonly string EventTutorialBegin = "tutorial_begin";
|
||||||
private static string EventLogin =>
|
internal static readonly string EventTutorialComplete = "tutorial_complete";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventLogin : "login";
|
internal static readonly string EventUnlockAchievement = "unlock_achievement";
|
||||||
private static string EventPostScore =>
|
internal static readonly string EventViewCart = "view_cart";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventPostScore : "post_score";
|
internal static readonly string EventViewItem = "view_item";
|
||||||
private static string EventPurchase =>
|
internal static readonly string EventViewItemList = "view_item_list";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventPurchase : "purchase";
|
internal static readonly string EventViewPromotion = "view_promotion";
|
||||||
private static string EventRefund =>
|
internal static readonly string EventViewSearchResults = "view_search_results";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventRefund : "refund";
|
internal static readonly string ParameterAchievementId = "achievement_id";
|
||||||
private static string EventRemoveFromCart =>
|
internal static readonly string ParameterAdFormat = "ad_format";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventRemoveFromCart : "remove_from_cart";
|
internal static readonly string ParameterAdNetworkClickID = "aclid";
|
||||||
private static string EventScreenView =>
|
internal static readonly string ParameterAdPlatform = "ad_platform";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventScreenView : "screen_view";
|
internal static readonly string ParameterAdSource = "ad_source";
|
||||||
private static string EventSearch =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSearch : "search";
|
|
||||||
private static string EventSelectContent =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSelectContent : "select_content";
|
|
||||||
private static string EventSelectItem =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSelectItem : "select_item";
|
|
||||||
private static string EventSelectPromotion =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSelectPromotion : "select_promotion";
|
|
||||||
private static string EventShare =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventShare : "share";
|
|
||||||
private static string EventSignUp =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSignUp : "sign_up";
|
|
||||||
private static string EventSpendVirtualCurrency =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventSpendVirtualCurrency : "spend_virtual_currency";
|
|
||||||
private static string EventTutorialBegin =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventTutorialBegin : "tutorial_begin";
|
|
||||||
private static string EventTutorialComplete =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventTutorialComplete : "tutorial_complete";
|
|
||||||
private static string EventUnlockAchievement =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventUnlockAchievement : "unlock_achievement";
|
|
||||||
private static string EventViewCart =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventViewCart : "view_cart";
|
|
||||||
private static string EventViewItem =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventViewItem : "view_item";
|
|
||||||
private static string EventViewItemList =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventViewItemList : "view_item_list";
|
|
||||||
private static string EventViewPromotion =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventViewPromotion : "view_promotion";
|
|
||||||
private static string EventViewSearchResults =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.EventViewSearchResults : "view_search_results";
|
|
||||||
private static string ParameterAchievementId =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAchievementId : "achievement_id";
|
|
||||||
private static string ParameterAdFormat =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAdFormat : "ad_format";
|
|
||||||
private static string ParameterAdNetworkClickID =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAdNetworkClickID : "aclid";
|
|
||||||
private static string ParameterAdPlatform =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAdPlatform : "ad_platform";
|
|
||||||
private static string ParameterAdSource =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAdSource : "ad_source";
|
|
||||||
|
|
||||||
private static string ParameterAffiliation =>
|
internal static readonly string ParameterAffiliation = "affiliation";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterAffiliation : "affiliation";
|
internal static readonly string ParameterCP1 = "cp1";
|
||||||
private static string ParameterCP1 =>
|
internal static readonly string ParameterCampaign = "campaign";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCP1 : "cp1";
|
internal static readonly string ParameterCharacter = "character";
|
||||||
private static string ParameterCampaign =>
|
internal static readonly string ParameterContent = "content";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCampaign : "campaign";
|
internal static readonly string ParameterContentType = "content_type";
|
||||||
private static string ParameterCharacter =>
|
internal static readonly string ParameterCoupon = "coupon";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCharacter : "character";
|
internal static readonly string ParameterCreativeName = "creative_name";
|
||||||
private static string ParameterContent =>
|
internal static readonly string ParameterCreativeSlot = "creative_slot";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterContent : "content";
|
internal static readonly string ParameterCurrency = "currency";
|
||||||
private static string ParameterContentType =>
|
internal static readonly string ParameterDestination = "destination";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterContentType : "content_type";
|
internal static readonly string ParameterDiscount = "discount";
|
||||||
private static string ParameterCoupon =>
|
internal static readonly string ParameterEndDate = "end_date";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCoupon : "coupon";
|
internal static readonly string ParameterExtendSession = "extend_session";
|
||||||
private static string ParameterCreativeName =>
|
internal static readonly string ParameterFlightNumber = "flight_number";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCreativeName : "creative_name";
|
internal static readonly string ParameterGroupId = "group_id";
|
||||||
private static string ParameterCreativeSlot =>
|
internal static readonly string ParameterIndex = "index";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCreativeSlot : "creative_slot";
|
internal static readonly string ParameterItemBrand = "item_brand";
|
||||||
private static string ParameterCurrency =>
|
internal static readonly string ParameterItemCategory = "item_category";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterCurrency : "currency";
|
internal static readonly string ParameterItemCategory2 = "item_category2";
|
||||||
private static string ParameterDestination =>
|
internal static readonly string ParameterItemCategory3 = "item_category3";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterDestination : "destination";
|
internal static readonly string ParameterItemCategory4 = "item_category4";
|
||||||
private static string ParameterDiscount =>
|
internal static readonly string ParameterItemCategory5 = "item_category5";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterDiscount : "discount";
|
internal static readonly string ParameterItemId = "item_id";
|
||||||
private static string ParameterEndDate =>
|
internal static readonly string ParameterItemList = "item_list";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterEndDate : "end_date";
|
internal static readonly string ParameterItemListID = "item_list_id";
|
||||||
private static string ParameterExtendSession =>
|
internal static readonly string ParameterItemListName = "item_list_name";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterExtendSession : "extend_session";
|
internal static readonly string ParameterItemName = "item_name";
|
||||||
private static string ParameterFlightNumber =>
|
internal static readonly string ParameterLevel = "level";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterFlightNumber : "flight_number";
|
internal static readonly string ParameterLevelName = "level_name";
|
||||||
private static string ParameterGroupId =>
|
internal static readonly string ParameterLocation = "location";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterGroupId : "group_id";
|
internal static readonly string ParameterLocationID = "location_id";
|
||||||
private static string ParameterIndex =>
|
internal static readonly string ParameterMedium = "medium";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterIndex : "index";
|
internal static readonly string ParameterMethod = "method";
|
||||||
private static string ParameterItemBrand =>
|
internal static readonly string ParameterNumberOfNights = "number_of_nights";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemBrand : "item_brand";
|
internal static readonly string ParameterNumberOfPassengers = "number_of_passengers";
|
||||||
private static string ParameterItemCategory =>
|
internal static readonly string ParameterNumberOfRooms = "number_of_rooms";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemCategory : "item_category";
|
internal static readonly string ParameterOrigin = "origin";
|
||||||
private static string ParameterItemCategory2 =>
|
internal static readonly string ParameterPaymentType = "payment_type";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemCategory2 : "item_category2";
|
internal static readonly string ParameterPrice = "price";
|
||||||
private static string ParameterItemCategory3 =>
|
internal static readonly string ParameterPromotionID = "promotion_id";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemCategory3 : "item_category3";
|
internal static readonly string ParameterPromotionName = "promotion_name";
|
||||||
private static string ParameterItemCategory4 =>
|
internal static readonly string ParameterQuantity = "quantity";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemCategory4 : "item_category4";
|
internal static readonly string ParameterScore = "score";
|
||||||
private static string ParameterItemCategory5 =>
|
internal static readonly string ParameterScreenClass = "screen_class";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemCategory5 : "item_category5";
|
internal static readonly string ParameterScreenName = "screen_name";
|
||||||
private static string ParameterItemId =>
|
internal static readonly string ParameterSearchTerm = "search_term";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemId : "item_id";
|
internal static readonly string ParameterShipping = "shipping";
|
||||||
private static string ParameterItemList =>
|
internal static readonly string ParameterShippingTier = "shipping_tier";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemListName : "item_id";
|
internal static readonly string ParameterSignUpMethod = "sign_up_method";
|
||||||
private static string ParameterItemListID =>
|
internal static readonly string ParameterSource = "source";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemListID : "item_list_id";
|
internal static readonly string ParameterStartDate = "start_date";
|
||||||
private static string ParameterItemListName =>
|
internal static readonly string ParameterSuccess = "success";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemListName : "item_list_name";
|
internal static readonly string ParameterTax = "tax";
|
||||||
private static string ParameterItemName =>
|
internal static readonly string ParameterTerm = "term";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterItemName : "item_name";
|
internal static readonly string ParameterTransactionId = "transaction_id";
|
||||||
private static string ParameterLevel =>
|
internal static readonly string ParameterTravelClass = "travel_class";
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterLevel : "level";
|
internal static readonly string ParameterValue = "value";
|
||||||
private static string ParameterLevelName =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterLevelName : "level_name";
|
|
||||||
private static string ParameterLocation =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterLocation : "location";
|
|
||||||
private static string ParameterLocationID =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterLocationID : "location_id";
|
|
||||||
private static string ParameterMedium =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterMedium : "medium";
|
|
||||||
private static string ParameterMethod =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterMethod : "method";
|
|
||||||
private static string ParameterNumberOfNights =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterNumberOfNights : "number_of_nights";
|
|
||||||
private static string ParameterNumberOfPassengers =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterNumberOfPassengers : "number_of_passengers";
|
|
||||||
private static string ParameterNumberOfRooms =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterNumberOfRooms : "number_of_rooms";
|
|
||||||
private static string ParameterOrigin =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterOrigin : "origin";
|
|
||||||
private static string ParameterPaymentType =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterPaymentType : "payment_type";
|
|
||||||
private static string ParameterPrice =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterPrice : "price";
|
|
||||||
private static string ParameterPromotionID =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterPromotionID : "promotion_id";
|
|
||||||
private static string ParameterPromotionName =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterPromotionName : "promotion_name";
|
|
||||||
private static string ParameterQuantity =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterQuantity : "quantity";
|
|
||||||
private static string ParameterScore =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterScore : "score";
|
|
||||||
private static string ParameterScreenClass =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterScreenClass : "screen_class";
|
|
||||||
private static string ParameterScreenName =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterScreenName : "screen_name";
|
|
||||||
private static string ParameterSearchTerm =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterSearchTerm : "search_term";
|
|
||||||
private static string ParameterShipping =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterShipping : "shipping";
|
|
||||||
private static string ParameterShippingTier =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterShippingTier : "shipping_tier";
|
|
||||||
private static string ParameterSignUpMethod =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.UserPropertySignUpMethod : "sign_up_method";
|
|
||||||
private static string ParameterSource =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterSource : "source";
|
|
||||||
private static string ParameterStartDate =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterStartDate : "start_date";
|
|
||||||
private static string ParameterSuccess =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterSuccess : "success";
|
|
||||||
private static string ParameterTax =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterTax : "tax";
|
|
||||||
private static string ParameterTerm =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterTerm : "term";
|
|
||||||
private static string ParameterTransactionId =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterTransactionId : "transaction_id";
|
|
||||||
private static string ParameterTravelClass =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterTravelClass : "travel_class";
|
|
||||||
private static string ParameterValue =>
|
|
||||||
FirebaseUtil.IsFirebaseInitialized ? FirebaseAnalytics.ParameterValue : "value";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -66,109 +66,34 @@ namespace Guru
|
||||||
/// <param name="level">关卡数</param>
|
/// <param name="level">关卡数</param>
|
||||||
/// <param name="levelName">关卡名称</param>
|
/// <param name="levelName">关卡名称</param>
|
||||||
/// <param name="levelType">关卡类型</param>
|
/// <param name="levelType">关卡类型</param>
|
||||||
/// <param name="levelConfigId">关卡配置表 ID</param>
|
/// <param name="itemId">关卡配置表 ID</param>
|
||||||
/// <param name="startType">启动方式</param>
|
/// <param name="startType">启动方式</param>
|
||||||
/// <param name="isReplay">是否是重玩</param>
|
/// <param name="isReplay">是否是重玩</param>
|
||||||
/// <param name="extra">额外数据</param>
|
/// <param name="extra">额外数据</param>
|
||||||
public static void LogLevelStart(int level, string levelName,
|
public static void LogLevelStart(int level, string levelName,
|
||||||
string levelType = "main", string levelConfigId = "", string startType = "play", bool isReplay = false,
|
string levelType = "main", string itemId = "", string startType = "play", bool isReplay = false,
|
||||||
Dictionary<string, object> extra = null)
|
Dictionary<string, object> extra = null)
|
||||||
{
|
{
|
||||||
Dictionary<string, object> dataDict = new Dictionary<string, object>()
|
Dictionary<string, object> dict = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterLevel, level },
|
{ ParameterLevel, level },
|
||||||
{ ParameterLevelName, levelName },
|
{ ParameterLevelName, levelName },
|
||||||
{ ParameterItemCategory, levelType },
|
{ ParameterItemCategory, levelType },
|
||||||
{ ParameterItemId, levelConfigId },
|
|
||||||
{ ParameterStartType, startType },
|
{ ParameterStartType, startType },
|
||||||
{ ParameterReplay, isReplay ? "true" : "false" },
|
{ ParameterReplay, isReplay ? "true" : "false" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(itemId))
|
||||||
|
dict[ParameterItemId] = itemId;
|
||||||
|
|
||||||
if (extra != null)
|
if (extra != null)
|
||||||
{
|
{
|
||||||
dataDict.AddRange(extra, isOverride:true);
|
dict.AddRange(extra, isOverride:true);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogEvent(EventLevelStart, dataDict);
|
LogEvent(EventLevelStart, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 玩家已开始挑战某个关卡时触发。
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemCategory">关卡类型(主关卡xx模式/每日挑战/活动1/活动2 等)</param>
|
|
||||||
/// <param name="itemID">棋局id /图片id</param>
|
|
||||||
/// <param name="levelName">关卡名称</param>
|
|
||||||
/// <param name="level">关卡数</param>
|
|
||||||
[Obsolete("Obsolete method, please use <LogLevelStart> instead. will be discard in next version.")]
|
|
||||||
internal static void LevelStart(string itemCategory, string itemID, string levelName, int level, bool isReplay, bool isContinue)
|
|
||||||
{
|
|
||||||
|
|
||||||
string startType = "play";
|
|
||||||
if (isReplay) startType = "replay";
|
|
||||||
if (isContinue) startType = "continue";
|
|
||||||
|
|
||||||
LogEvent(EventLevelStart, new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
{ ParameterItemCategory, itemCategory},
|
|
||||||
{ ParameterItemId, itemID},
|
|
||||||
{ ParameterLevelName, levelName },
|
|
||||||
{ ParameterLevel, level },
|
|
||||||
{ ParameterReplay, isReplay ? "true" : "false"},
|
|
||||||
{ ParameterContinue, isContinue ? "true" : "false"},
|
|
||||||
{ ParameterStartType, startType },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关卡结束(Firebase标准事件)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="itemCategory">关卡类型(主关卡xx模式/每日挑战/活动1/活动2 等)</param>
|
|
||||||
/// <param name="itemID">棋局id /图片id</param>
|
|
||||||
/// <param name="levelName">关卡名称</param>
|
|
||||||
/// <param name="level">关卡数</param>
|
|
||||||
/// <param name="result">"此参数是对success参数的补充说明,除成功/失败/超时/退出这四种情况外,其余情况可自行定义值"</param>
|
|
||||||
/// <param name="duration">游戏时长(单位:msec)【可选】</param>
|
|
||||||
/// <param name="step">游戏步数【可选】</param>
|
|
||||||
/// <param name="score">游戏分数【可选】</param>
|
|
||||||
/// <param name="isReplay">重玩标记【可选】</param>
|
|
||||||
[Obsolete("Obsolete method, please use <LogLevelEnd> instead. will be discard in next version.")]
|
|
||||||
internal static void LevelEnd(string itemCategory, string itemID, string levelName, int level,
|
|
||||||
ELevelResult result, int? duration = null, int? step = null, int? score = null, bool isReplay = false,
|
|
||||||
Dictionary<string, object> extra = null)
|
|
||||||
{
|
|
||||||
var dict = new Dictionary<string, object>()
|
|
||||||
{
|
|
||||||
{ ParameterItemCategory, itemCategory },
|
|
||||||
{ ParameterItemId, itemID },
|
|
||||||
{ ParameterLevelName, levelName },
|
|
||||||
{ ParameterLevel, level },
|
|
||||||
{ ParameterSuccess, result == ELevelResult.success ? "true" : "false" },
|
|
||||||
{ ParameterResult, result.ToString() },
|
|
||||||
{ ParameterReplay, isReplay ? "true" : "false"},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (duration != null)
|
|
||||||
dict[ParameterDuration] = duration.Value;
|
|
||||||
if(step != null)
|
|
||||||
dict[ParameterStep] = step.Value;
|
|
||||||
if(score != null)
|
|
||||||
dict[ParameterScore] = score.Value;
|
|
||||||
if(extra != null)
|
|
||||||
dict.AddRange(extra, isOverride:true);
|
|
||||||
|
|
||||||
LogEvent(EventLevelEnd, dict);
|
|
||||||
|
|
||||||
if (result == ELevelResult.success)
|
|
||||||
{
|
|
||||||
int lv = BPlay;
|
|
||||||
if (lv == 0) lv = level;
|
|
||||||
LevelEndSuccess(lv, itemCategory, itemID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关卡结束(Firebase标准事件)
|
/// 关卡结束(Firebase标准事件)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -176,30 +101,29 @@ namespace Guru
|
||||||
/// <param name="result"></param>
|
/// <param name="result"></param>
|
||||||
/// <param name="levelName"></param>
|
/// <param name="levelName"></param>
|
||||||
/// <param name="levelType"></param>
|
/// <param name="levelType"></param>
|
||||||
/// <param name="puzzleId"></param>
|
/// <param name="itemId"></param>
|
||||||
/// <param name="duration"></param>
|
/// <param name="duration"></param>
|
||||||
/// <param name="step"></param>
|
/// <param name="step"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <param name="extra"></param>
|
/// <param name="extra"></param>
|
||||||
public static void LogLevelEnd(int level, string result,
|
public static void LogLevelEnd(int level, string result,
|
||||||
string levelName = "", string levelType = "main", string puzzleId = "",
|
string levelName = "", string levelType = "main", string itemId = "",
|
||||||
int? duration = null, int? step = null, int? score = null, Dictionary<string, object> extra = null)
|
int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null)
|
||||||
{
|
{
|
||||||
bool isSuccess = result.Equals("success");
|
bool isSuccess = result.Equals("success");
|
||||||
|
|
||||||
var dict = new Dictionary<string, object>()
|
var dict = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, levelType },
|
[ParameterLevel] = level,
|
||||||
{ ParameterLevelName, levelName },
|
[ParameterLevelName] = levelName,
|
||||||
{ ParameterLevel, level },
|
[ParameterItemCategory] = levelType,
|
||||||
{ ParameterSuccess, isSuccess ? "true" : "false" },
|
[ParameterSuccess] = isSuccess ? "true" : "false",
|
||||||
{ ParameterResult, result },
|
[ParameterResult] = result,
|
||||||
|
[ParameterDuration] = duration
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!string.IsNullOrEmpty(puzzleId))
|
if(!string.IsNullOrEmpty(itemId))
|
||||||
dict[ParameterItemId] = puzzleId;
|
dict[ParameterItemId] = itemId;
|
||||||
if (duration != null)
|
|
||||||
dict[ParameterDuration] = duration.Value;
|
|
||||||
if(step != null)
|
if(step != null)
|
||||||
dict[ParameterStep] = step.Value;
|
dict[ParameterStep] = step.Value;
|
||||||
if(score != null)
|
if(score != null)
|
||||||
|
|
@ -213,7 +137,7 @@ namespace Guru
|
||||||
{
|
{
|
||||||
int lv = BPlay;
|
int lv = BPlay;
|
||||||
if (lv == 0) lv = level;
|
if (lv == 0) lv = level;
|
||||||
LevelEndSuccess(lv, levelType, puzzleId);
|
LevelEndSuccess(lv, levelType, itemId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,20 +146,30 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新用户通过第几关(仅记录前n关,根据项目自行确定,不区分关卡类型)[买量用]
|
/// 新用户通过第几关(仅记录前n关,根据项目自行确定,不区分关卡类型)[买量用]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="level">总计完成的管卡数 (b_play)</param>
|
||||||
/// <param name="levelType"></param>
|
/// <param name="levelType"></param>
|
||||||
/// <param name="level">关卡(从1开始)</param>
|
/// <param name="itemId">棋局id /图片id</param>
|
||||||
/// /// <param name="puzzleId">棋局id /图片id</param>
|
public static void LevelEndSuccess( int level, string levelType = "", string itemId = "")
|
||||||
public static void LevelEndSuccess( int level, string levelType, string puzzleId)
|
|
||||||
{
|
{
|
||||||
if (level > GuruSettings.Instance.AnalyticsSetting.LevelEndSuccessNum)
|
if (level > GuruSettings.Instance.AnalyticsSetting.LevelEndSuccessNum)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string eventName = $"level_end_success_{level}";
|
string eventName = $"level_end_success_{level}";
|
||||||
LogEvent(eventName,new Dictionary<string, object>()
|
var dict = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterLevel, level },
|
{ ParameterLevel, level },
|
||||||
{ ParameterItemId, puzzleId },
|
};
|
||||||
{ ParameterItemCategory, levelType}
|
|
||||||
|
if(!string.IsNullOrEmpty(levelType))
|
||||||
|
dict[ParameterItemCategory] = levelType;
|
||||||
|
if(!string.IsNullOrEmpty(itemId))
|
||||||
|
dict[ParameterItemId] = itemId;
|
||||||
|
|
||||||
|
LogEvent(eventName, dict, new EventSetting()
|
||||||
|
{
|
||||||
|
EnableFirebaseAnalytics = true,
|
||||||
|
EnableFacebookAnalytics = true,
|
||||||
|
EnableAdjustAnalytics = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -479,6 +413,7 @@ namespace Guru
|
||||||
/// Google ARO买量点
|
/// Google ARO买量点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="impressionData">广告收入数据</param>
|
/// <param name="impressionData">广告收入数据</param>
|
||||||
|
/// <param name="platform">广告平台</param>
|
||||||
/// <a href="https://docs.google.com/spreadsheets/d/1lFWLeOGJgq34QDBTfl6OpNh7MoI37ehGrhdbxlOrJgs/edit#gid=983654222"></a>
|
/// <a href="https://docs.google.com/spreadsheets/d/1lFWLeOGJgq34QDBTfl6OpNh7MoI37ehGrhdbxlOrJgs/edit#gid=983654222"></a>
|
||||||
/// <li>
|
/// <li>
|
||||||
/// value double eg:0.002
|
/// value double eg:0.002
|
||||||
|
|
@ -489,14 +424,15 @@ namespace Guru
|
||||||
/// ad_unit_name string 广告位名称
|
/// ad_unit_name string 广告位名称
|
||||||
/// ad_creative_id string 广告素材id
|
/// ad_creative_id string 广告素材id
|
||||||
/// </li>
|
/// </li>
|
||||||
public static void ADImpression(MaxSdkBase.AdInfo impressionData)
|
public static void ADImpression(MaxSdkBase.AdInfo impressionData, string platform = "")
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(platform)) platform = AdMAX;
|
||||||
double revenue = impressionData.Revenue;
|
double revenue = impressionData.Revenue;
|
||||||
LogEvent(EventAdImpression, new Dictionary<string, dynamic>()
|
LogEvent(EventAdImpression, new Dictionary<string, dynamic>()
|
||||||
{
|
{
|
||||||
[ParameterValue] = revenue,
|
[ParameterValue] = revenue,
|
||||||
[ParameterCurrency] = USD,
|
[ParameterCurrency] = USD,
|
||||||
[ParameterAdPlatform] = AdMAX,
|
[ParameterAdPlatform] = platform,
|
||||||
[ParameterAdSource] = impressionData.NetworkName,
|
[ParameterAdSource] = impressionData.NetworkName,
|
||||||
[ParameterAdFormat] = impressionData.AdFormat,
|
[ParameterAdFormat] = impressionData.AdFormat,
|
||||||
[ParameterAdUnitName] = impressionData.AdUnitIdentifier,
|
[ParameterAdUnitName] = impressionData.AdUnitIdentifier,
|
||||||
|
|
@ -569,10 +505,11 @@ namespace Guru
|
||||||
/// <param name="currency">用户的付费币种</param>
|
/// <param name="currency">用户的付费币种</param>
|
||||||
/// <param name="orderId">订单 ID</param>
|
/// <param name="orderId">订单 ID</param>
|
||||||
/// <param name="type">付费类型订阅/产品(subscription/product)</param>
|
/// <param name="type">付费类型订阅/产品(subscription/product)</param>
|
||||||
/// <param name="isfree">是否为试用(1:试用,0:付费)</param>
|
/// <param name="isFree">是否为试用(1:试用,0:付费)</param>
|
||||||
public static void IAPRetTrue(string scene, string productId, double value, string currency, string orderId, string type, bool isfree)
|
/// <param name="offerId">若存在 Offer 的话需要上报 OfferID</param>
|
||||||
|
internal static void IAPRetTrue(string scene, string productId, double value, string currency, string orderId, string type, bool isFree = false, string offerId = "")
|
||||||
{
|
{
|
||||||
LogEvent(EventIAPReturnTrue, new Dictionary<string, object>()
|
var dict = new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, scene },
|
{ ParameterItemCategory, scene },
|
||||||
{ ParameterItemName, productId },
|
{ ParameterItemName, productId },
|
||||||
|
|
@ -580,22 +517,34 @@ namespace Guru
|
||||||
{ ParameterValue, value },
|
{ ParameterValue, value },
|
||||||
{ ParameterCurrency, currency },
|
{ ParameterCurrency, currency },
|
||||||
{ "order_id", orderId },
|
{ "order_id", orderId },
|
||||||
{ "type", type },
|
{ "type", type },
|
||||||
{ "isfree", isfree ? 1 : 0 },
|
{ "isfree", isFree ? 1 : 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(offerId))
|
||||||
|
dict["basePlan"] = offerId;
|
||||||
|
|
||||||
|
LogEvent(EventIAPReturnTrue, dict, new EventSetting()
|
||||||
|
{
|
||||||
|
EnableFirebaseAnalytics = true,
|
||||||
|
EnableAdjustAnalytics = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "app 内弹出的付费引导IAP付费或试用失败打点"
|
/// "app 内弹出的付费引导IAP付费或试用失败打点"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemCategory">界面跳转的来源</param>
|
/// <param name="itemCategory">界面跳转的来源</param>
|
||||||
/// <param name="productID">product id,多个产品用逗号分隔,第一个商品id放主推商品id</param>
|
/// <param name="productId">product id,多个产品用逗号分隔,第一个商品id放主推商品id</param>
|
||||||
public static void IAPRetFalse(string itemCategory, string productID, string failReason)
|
/// <param name="failReason"></param>
|
||||||
|
internal static void IAPRetFalse(string itemCategory, string productId, string failReason)
|
||||||
{
|
{
|
||||||
LogEvent(EventIAPReturnFalse, new Dictionary<string, object>()
|
LogEvent(EventIAPReturnFalse, new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ ParameterItemCategory, itemCategory },
|
{ ParameterItemCategory, itemCategory },
|
||||||
{ ParameterItemName, productID },
|
{ ParameterItemName, productId },
|
||||||
|
{ ParameterProductId, productId },
|
||||||
{ ParameterResult, failReason }
|
{ ParameterResult, failReason }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -660,28 +609,27 @@ namespace Guru
|
||||||
string orderDate = orderData.payedDate;
|
string orderDate = orderData.payedDate;
|
||||||
string scene = orderData.scene;
|
string scene = orderData.scene;
|
||||||
bool isFree = orderData.isFree;
|
bool isFree = orderData.isFree;
|
||||||
|
string offerId = orderData.offerId;
|
||||||
// TCH 001
|
// TCH 001
|
||||||
Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate);
|
Tch001IAPRev(usdPrice, productId, orderId, orderType, orderDate);
|
||||||
// TCH 020
|
// TCH 020
|
||||||
Tch02IAPRev(usdPrice, productId, orderId, orderType, orderDate);
|
Tch02IAPRev(usdPrice, productId, orderId, orderType, orderDate);
|
||||||
// Adjust Track IAP Purchase
|
|
||||||
AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件
|
|
||||||
// Facebook Track IAP Purchase
|
// Facebook Track IAP Purchase
|
||||||
FBPurchase(usdPrice, USD, "iap", IAPPlatform);
|
FBPurchase(usdPrice, USD, "iap", IAPPlatform);
|
||||||
|
|
||||||
if (orderData.orderType == 1)
|
if (orderData.orderType == 1)
|
||||||
{
|
{
|
||||||
// sub_pruchase
|
// sub_pruchase : Firebase + Guru + Adjust
|
||||||
SubPurchase(usdPrice, productId, orderId, orderDate);
|
SubPurchase(usdPrice, productId, orderId, orderDate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// iap_purchase
|
// iap_purchase : Firebase + Guru + Adjust
|
||||||
IAPPurchase(usdPrice, productId, orderId, orderDate);
|
IAPPurchase(usdPrice, productId, orderId, orderDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IAP Ret true
|
// IAP Ret true : Firebase + Guru + Adjust
|
||||||
IAPRetTrue(scene, productId, payPrice, userCurrency, orderId, orderType2, isFree);
|
IAPRetTrue(scene, productId, payPrice, userCurrency, orderId, orderType2, isFree, offerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -714,7 +662,7 @@ namespace Guru
|
||||||
[ParameterPlatform] = IAPPlatform,
|
[ParameterPlatform] = IAPPlatform,
|
||||||
[ParameterValue] = value,
|
[ParameterValue] = value,
|
||||||
[ParameterCurrency] = USD,
|
[ParameterCurrency] = USD,
|
||||||
["product_id"] = productId,
|
[ParameterProductId] = productId,
|
||||||
["order_id"] = orderId,
|
["order_id"] = orderId,
|
||||||
["order_type"] = orderType,
|
["order_type"] = orderType,
|
||||||
["trans_ts"] = orderDate
|
["trans_ts"] = orderDate
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,9 @@ namespace Guru
|
||||||
parameters.Add(new Parameter(kv.Key, doubleValue));
|
parameters.Add(new Parameter(kv.Key, doubleValue));
|
||||||
else if (kv.Value is decimal decimalValue)
|
else if (kv.Value is decimal decimalValue)
|
||||||
parameters.Add(new Parameter(kv.Key, decimal.ToDouble(decimalValue)));
|
parameters.Add(new Parameter(kv.Key, decimal.ToDouble(decimalValue)));
|
||||||
|
else
|
||||||
|
parameters.Add(new Parameter(kv.Key, kv.Value.ToString()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FirebaseAnalytics.LogEvent(eventName, parameters.ToArray());
|
FirebaseAnalytics.LogEvent(eventName, parameters.ToArray());
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,13 @@ namespace Guru
|
||||||
|
|
||||||
public static AppleOrderRequest Build(int orderType, string productId,
|
public static AppleOrderRequest Build(int orderType, string productId,
|
||||||
string receipt, string orderId, string date, int level,
|
string receipt, string orderId, string date, int level,
|
||||||
string userCurrency, double payPrice, string scene, bool isFree = false)
|
string userCurrency, double payPrice, string scene, bool isFree = false, string offerId = "", string basePlanId = "")
|
||||||
{
|
{
|
||||||
var request = new AppleOrderRequest()
|
var request = new AppleOrderRequest()
|
||||||
{
|
{
|
||||||
receipt = receipt,
|
receipt = receipt,
|
||||||
orderData = new AppleOrderData(orderType, productId, receipt, orderId, date, level,
|
orderData = new AppleOrderData(orderType, productId, receipt, orderId, date, level,
|
||||||
userCurrency, payPrice, scene, isFree),
|
userCurrency, payPrice, scene, isFree, offerId, basePlanId),
|
||||||
};
|
};
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -288,9 +288,6 @@ namespace Guru
|
||||||
_googlePlayStoreExtensions.RestoreTransactions(OnRestoreHandle);
|
_googlePlayStoreExtensions.RestoreTransactions(OnRestoreHandle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var product in _storeController.products.all)
|
foreach (var product in _storeController.products.all)
|
||||||
{
|
{
|
||||||
if (!product.availableToPurchase)
|
if (!product.availableToPurchase)
|
||||||
|
|
@ -1022,6 +1019,10 @@ namespace Guru
|
||||||
/// <param name="orderId"></param>
|
/// <param name="orderId"></param>
|
||||||
/// <param name="date"></param>
|
/// <param name="date"></param>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
|
/// <param name="userCurrency"></param>
|
||||||
|
/// <param name="payPrice"></param>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="isFree"></param>
|
||||||
/// <param name="offerId"></param>
|
/// <param name="offerId"></param>
|
||||||
/// <param name="basePlanId"></param>
|
/// <param name="basePlanId"></param>
|
||||||
private void ReportAppleOrder(int orderType, string productId, string receipt,
|
private void ReportAppleOrder(int orderType, string productId, string receipt,
|
||||||
|
|
@ -1030,7 +1031,7 @@ namespace Guru
|
||||||
{
|
{
|
||||||
var payedDate = TimeUtil.GetTimeStampString(date);
|
var payedDate = TimeUtil.GetTimeStampString(date);
|
||||||
var request = AppleOrderRequest.Build(orderType, productId, receipt, orderId, payedDate, level,
|
var request = AppleOrderRequest.Build(orderType, productId, receipt, orderId, payedDate, level,
|
||||||
userCurrency, payPrice, scene, isFree);
|
userCurrency, payPrice, scene, isFree, offerId, basePlanId);
|
||||||
ReportNextOrder(request);
|
ReportNextOrder(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue