iOS finder adjust event

This commit is contained in:
xiaohui.wang 2022-05-11 20:02:01 +08:00
parent 4a4c20b6ba
commit bf49d422c9
8 changed files with 322 additions and 64 deletions

View File

@ -184,7 +184,7 @@ public class JoypacStaticBuildPostProcessor
#if IssuePerson
proj.AddBuildProperty(target, "OTHER_LINKER_FLAGS", "-ObjC");
proj.AddBuildProperty(targetMain, "OTHER_LDFLAGS", "-ObjC");
#endif
File.WriteAllText(projPath, proj.WriteToString());
@ -213,6 +213,9 @@ public class JoypacStaticBuildPostProcessor
plist.root.SetBoolean("Identity", false);
plist.root.SetBoolean("LegalName", false);
plist.root.SetString("BytePlusAppId", "353656");
plist.root.SetBoolean("isChina", true);
plist.root.SetString("KlevinApplicationIdentifier", "");
File.WriteAllText(plistPath, plist.WriteToString());

View File

@ -4,6 +4,8 @@ using UnityEngine;
using System.Runtime.InteropServices;
using System;
using LitJson;
public class JoypacAdClient : MonoBehaviour
{
@ -107,10 +109,38 @@ public class JoypacAdClient : MonoBehaviour
[DllImport("__Internal")]
private static extern void setDataReportEnviroment(string enviroment);
// Finder数据埋点上传
[DllImport("__Internal")]
private static extern void uploadEvent(string eventId, string eventParams);
// Finder用户属性设置
[DllImport("__Internal")]
private static extern void profileSet(string profileParams);
//Finder相关
public void UploadEvent(string eventId, string eventParams)
{
uploadEvent(eventId, eventParams);
}
public void ProfileSet(string profileParams)
{
profileSet(profileParams);
}
//设置 上报环境
public void SetDataReportEnviroment(string enviroment)
{
#if UNITY_EDITOR
return;
#endif
setDataReportEnviroment(enviroment);
}
@ -186,6 +216,8 @@ public class JoypacAdClient : MonoBehaviour
Debug.Log("oc call unity ReceiveExtraData " + extraData);
JoypacUtils.extraData = extraData;
}
//unity 发送adjust回传字段给OC
@ -342,9 +374,6 @@ public class JoypacAdClient : MonoBehaviour
showRewardVideoWithPlacementId(unitId, eventPosition);
}
#endregion
@ -365,59 +394,104 @@ public class JoypacAdClient : MonoBehaviour
#endregion
#region intersititalCallback
public void JoypacIntersititalAdLoad()
public void JoypacIntersititalAdLoad(string json)
{
LogTool.DebugLog("joypac oc call unity ivloaded");
LogTool.DebugLog("joypac oc call unity ivloaded " + json);
JoypacSDKAdapter.Instance.onInterstitialAdLoad();
}
public void JoypacIntersititalAdLoadFail()
public void JoypacIntersititalAdLoadFail(string json)
{
LogTool.DebugLog("joypac oc call unity ivloadfail");
LogTool.DebugLog("joypac oc call unity ivloadfail " + json);
JoypacSDKAdapter.Instance.onInterstitialAdLoadFail();
}
public void JoypacIntersititalAdShow()
public void JoypacIntersititalAdShow(string json)
{
LogTool.DebugLog("joypac oc call unity ivshow");
LogTool.DebugLog("joypac oc call unity ivshow " + json);
JoypacSDKAdapter.Instance.onInterstitialAdShow();
Debug.Log("adjust interstitial show打点准备");
if (!string.IsNullOrEmpty(json))
{
Debug.Log("adjust interstitial show打点json回调不为空");
//规避安卓两次回调
if (!JoypacAdManager.IntersShow)
{
Debug.Log("adjust interstitial show打点当前次可用");
JoypacAdManager.IntersShow = true;
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
Debug.Log("finder 插屏展示准备");
JoypacAnalyticsManager.Instance.APPAdsShow(jsonTemp);
Debug.Log("finder 插屏展示结束");
string newsss = jsonTemp["price_int"].ToString();
double newEcpm = double.Parse(newsss);
Debug.Log("newEcpm" + newEcpm);
JoypacAnalyticsManager.DesignEvent_ECPM(newEcpm, jsonTemp["currency"].ToString(), ConstStringKey.Instance.IV_ECPM);
}
}
Debug.Log("adjust interstitial show打点结束");
}
public void JoypacIntersititalAdsShowFail()
public void JoypacIntersititalAdsShowFail(string json)
{
LogTool.DebugLog("joypac oc call unity ivshowfail");
LogTool.DebugLog("joypac oc call unity ivshowfail " + json);
JoypacSDKAdapter.Instance.onInterstitialAdFailedToShow();
}
public void JoypacIntersititalAdClose()
public void JoypacIntersititalAdClose(string json)
{
LogTool.DebugLog("joypac oc call unity ivclose");
LogTool.DebugLog("joypac oc call unity ivclose " + json);
JoypacSDKAdapter.Instance.onInterstitialAdClose();
}
public void JoypacIntersititalAdClick()
public void JoypacIntersititalAdClick(string json)
{
Debug.Log("joypac " + json);
JoypacSDKAdapter.Instance.onInterstitialAdClick();
Debug.Log("finder Interstitial click 准备");
if (!string.IsNullOrEmpty(json))
{
Debug.Log("finder Interstitial click 开始");
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
JoypacAnalyticsManager.Instance.APPAdsClick(jsonTemp);
}
Debug.Log("finder Interstitial click 结束");
}
public void JoypacIntersititalAdsEndPlaying()
public void JoypacIntersititalAdsEndPlaying(string json)
{
Debug.Log("joypac " + json);
JoypacSDKAdapter.Instance.onInterstitialAdEndPlayingVideo();
}
public void JoypacIntersititalAdFailedToPlay()
public void JoypacIntersititalAdFailedToPlay(string json)
{
Debug.Log("joypac " + json);
JoypacSDKAdapter.Instance.onInterstitialAdFailedToPlayVideo();
}
public void JoypacIntersititalAdsStartPlayVideo()
public void JoypacIntersititalAdsStartPlayVideo(string json)
{
Debug.Log("joypac " + json);
JoypacSDKAdapter.Instance.onInterstitialAdStartPlayingVideo();
}
@ -425,51 +499,110 @@ public class JoypacAdClient : MonoBehaviour
#endregion
#region videoCallback
public void JoypacVideoAdLoaded()
public void JoypacVideoAdLoaded(string json)
{
LogTool.DebugLog("joypac oc call unity videoloaded");
LogTool.DebugLog("joypac oc call unity videoloaded " + json);
JoypacSDKAdapter.Instance.onRewardedVideoAdLoaded();
}
public void JoypacVideoAdLoadFail()
public void JoypacVideoAdLoadFail(string json)
{
LogTool.DebugLog("joypac oc call unity videoloadfail");
LogTool.DebugLog("joypac oc call unity videoloadfail " + json);
JoypacSDKAdapter.Instance.onRewardedVideoAdLoadFail();
}
public void JoypacVideoAdPlayStart()
public void JoypacVideoAdPlayStart(string json)
{
LogTool.DebugLog("joypac oc call unity videostartplay");
LogTool.DebugLog("joypac oc call unity videostartplay = " + json);
JoypacSDKAdapter.Instance.onRewardedVideoAdPlayStart();
Debug.Log("adjust reward show打点准备");
if (!string.IsNullOrEmpty(json))
{
Debug.Log("adjust reward show打点json回调不为空");
//规避安卓两次回调
if (!JoypacAdManager.VideoShow)
{
Debug.Log("adjust reward show打点当前次可用");
JoypacAdManager.VideoShow = true;
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
JoypacAnalyticsManager.Instance.APPAdsShow(jsonTemp);
Debug.Log("finder 激励视频展示结束");
string newsss = jsonTemp["price_int"].ToString();
double newEcpm = double.Parse(newsss);
Debug.Log("newEcpm" + newEcpm);
JoypacAnalyticsManager.DesignEvent_ECPM(newEcpm, jsonTemp["currency"].ToString(), ConstStringKey.Instance.RV_ECPM);
}
}
Debug.Log("adjust reward show打点结束");
}
public void JoypacVideoAdPlayEnd()
public void JoypacVideoAdPlayEnd(string json)
{
LogTool.DebugLog("joypac oc call unity playend");
LogTool.DebugLog("joypac oc call unity playend " + json);
JoypacSDKAdapter.Instance.onRewardedVideoAdPlayEnd();
}
public void JoypacVideoAdPlayFail()
public void JoypacVideoAdPlayFail(string json)
{
LogTool.DebugLog("joypac oc call unity videoplayfail");
LogTool.DebugLog("joypac oc call unity videoplayfail" + json);
JoypacSDKAdapter.Instance.onRewardedVideoAdPlayFail();
}
public void JoypacVideoAdPlayClosed(string isRewardStr)
{
bool isReward = Convert.ToBoolean(isRewardStr);
LogTool.DebugLog("oc call unity video close ");
LogTool.DebugLog("joypac " + isRewardStr);
bool isReward = false;
if (isRewardStr == "1")
{
isReward = true;
}
LogTool.DebugLog("oc call unity video close + isReward" + isReward);
JoypacSDKAdapter.Instance.onRewardedVideoAdPlayClosed(isReward);
}
public void JoypacVideoAdPlayRewarded(string json)
{
LogTool.DebugLog("joypac JoypacVideoAdPlayRewarded" + json);
Debug.Log("finder Reward 奖励回调打点准备");
if (!string.IsNullOrEmpty(json))
{
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
Debug.Log("finder Reward App_Ads_Reward");
JoypacAnalyticsManager.Instance.AppAdsReward(jsonTemp);
}
Debug.Log("finder Reward 奖励回调打点结束");
}
public void JoypacVideoAdPlayClicked()
public void JoypacVideoAdPlayClicked(string json)
{
LogTool.DebugLog("joypac " + json);
Debug.Log("finder Reward click 准备");
if (!string.IsNullOrEmpty(json))
{
Debug.Log("finder Reward click 开始");
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
JoypacAnalyticsManager.Instance.aPPAdsShowAdType = "Reward";
JoypacAnalyticsManager.Instance.APPAdsClick(jsonTemp);
}
Debug.Log("finder Reward click 结束");
}
@ -478,36 +611,62 @@ public class JoypacAdClient : MonoBehaviour
#region bannerCallback
public void JoypacBannerAdLoad()
public void JoypacBannerAdLoad(string json)
{
LogTool.DebugLog("joypac oc call unity bannerLoad");
LogTool.DebugLog("joypac oc call unity bannerLoad " + json);
JoypacSDKAdapter.Instance.onNativeBannerAdLoaded();
}
public void JoypacBannerAdLoadFail()
public void JoypacBannerAdLoadFail(string json)
{
LogTool.DebugLog("joypac oc call unity bannerLoadFail");
LogTool.DebugLog("joypac oc call unity bannerLoadFail " + json);
JoypacSDKAdapter.Instance.onNativeBannerAdLoadFail();
}
public void JoypacBannerAdDidShow()
public void JoypacBannerAdDidShow(string json)
{
LogTool.DebugLog("joypac oc call unity bannerDidShow");
LogTool.DebugLog("joypac oc call unity bannerDidShow " + json);
JoypacSDKAdapter.Instance.onNativeBannerAdImpressed();
Debug.Log("banner show打点准备");
if (!string.IsNullOrEmpty(json))
{
Debug.Log("banner show打点json回调不为空");
//规避安卓两次回调
if (!JoypacAdManager.BannerShow)
{
Debug.Log("banner show打点当前次可用");
JoypacAdManager.BannerShow = true;
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
JoypacAnalyticsManager.Instance.App_Banner_Show(jsonTemp);
}
}
Debug.Log("banner show打点结束");
}
public void JoypacBannerAdDidClick()
public void JoypacBannerAdDidClick(string json)
{
LogTool.DebugLog("joypac oc call unity bannerDidClick");
LogTool.DebugLog("joypac oc call unity bannerDidClick " + json);
JoypacSDKAdapter.Instance.onNativeBannerAdClicked();
if (!string.IsNullOrEmpty(json))
{
Dictionary<string, object> jsonTemp = new Dictionary<string, object>();
jsonTemp = JsonMapper.ToObject<Dictionary<string, object>>(json);
JoypacAnalyticsManager.Instance.App_Banner_Click(jsonTemp);
}
}
public void JoypacBannerAdDidClickCloseButton()
public void JoypacBannerAdDidClickCloseButton(string json)
{
LogTool.DebugLog("joypac oc call unity bannerDidClickCloseButton");
LogTool.DebugLog("joypac oc call unity bannerDidClickCloseButton " + json);
JoypacSDKAdapter.Instance.onNativeBannerAdCloseButtonClicked();
}
@ -515,54 +674,54 @@ public class JoypacAdClient : MonoBehaviour
#endregion
#region nativeCallback
public void JoypacNativeAdLoadFail()
public void JoypacNativeAdLoadFail(string json)
{
LogTool.DebugLog("joypac oc call unity nativeloadfail");
LogTool.DebugLog("joypac oc call unity nativeloadfail " + json);
JoypacSDKAdapter.Instance.onNativeAdLoadFail();
}
public void JoypacNativeAdLoaded()
public void JoypacNativeAdLoaded(string json)
{
LogTool.DebugLog("joypac oc call unity nativeloaded");
LogTool.DebugLog("joypac oc call unity nativeloaded " + json);
JoypacSDKAdapter.Instance.onNativeAdLoaded();
}
public void JoypacNativeAdDidShow()
public void JoypacNativeAdDidShow(string json)
{
LogTool.DebugLog("joypac oc call unity nativedidshow");
LogTool.DebugLog("joypac oc call unity nativedidshow " + json);
JoypacSDKAdapter.Instance.onNativeAdImpressed();
}
public void JoypacNativeAdDidClick()
public void JoypacNativeAdDidClick(string json)
{
LogTool.DebugLog("joypac oc call unity nativedidclick");
LogTool.DebugLog("joypac oc call unity nativedidclick " + json);
JoypacSDKAdapter.Instance.onNativeAdClicked();
}
#endregion
#region splashCallback
public void JoypacSplashAdLoaded()
public void JoypacSplashAdLoaded(string json)
{
Debug.Log("joypac oc call unity 开屏请求成功");
Debug.Log("joypac oc call unity 开屏请求成功 " + json);
}
public void JoypacSplashAdLoadFail()
public void JoypacSplashAdLoadFail(string json)
{
Debug.Log("joypac oc call unity 开屏请求失败");
Debug.Log("joypac oc call unity 开屏请求失败 " + json);
}
public void JoypacSplashAdDidShow()
public void JoypacSplashAdDidShow(string json)
{
Debug.Log("joypac oc call unity 展示开屏");
Debug.Log("joypac oc call unity 展示开屏 " + json);
}
public void JoypacSplashAdDidClick()
public void JoypacSplashAdDidClick(string json)
{
Debug.Log("joypac oc call unity 点击开屏");
Debug.Log("joypac oc call unity 点击开屏 " + json);
}
public void JoypacSplashAdDidClose()
public void JoypacSplashAdDidClose(string json)
{
Debug.Log("joypac oc call unity 开屏关闭");
Debug.Log("joypac oc call unity 开屏关闭 " + json);
}
#endregion

View File

@ -182,6 +182,16 @@ public class ConstStringKey
public string GAME_FINISH = "";//必填
public string ADJUST_EVENT_RV24 = "h61tti";//必填
public string ADJUST_EVENT_RVIV24 = "n087kg";//必填
public string RV_ECPM = "p9gwke";
public string IV_ECPM = "csho1l";
public string EnterGame = "";
public const string ADJUST_LEVELCOUNT = "";
public const string ADJUST_FIRSTAD = "lzflg8";
public const string ADJUST_FIRSTLEVEL = "dspnce";
public const string ADJUST_FIRSTMAINPAGE = "om2nvg";
#elif UNITY_ANDROID
public string DEVICEINFO_IPHONE_TOKEN = "pj2o55";//必填
public string DEVICEINFO_IPAD_TOKEN = "a2txyw";//必填
@ -195,6 +205,17 @@ public class ConstStringKey
public string GAME_FINISH = "";//必填
public string ADJUST_EVENT_RV24 = "9mlkw2";//必填
public string ADJUST_EVENT_RVIV24 = "jwnqhw";//必填
public string RV_ECPM = "jg4abn";
public string IV_ECPM = "wnsqf0";
public string EnterGame = "";
public const string ADJUST_LEVELCOUNT = "";
public const string ADJUST_FIRSTAD = "5601ah";
public const string ADJUST_FIRSTLEVEL = "6ymf40";
public const string ADJUST_FIRSTMAINPAGE = "gybndv";
#endif
}

View File

@ -220,6 +220,13 @@ public class JoypacAnalyticsManager : MonoBehaviour
Debug.Log("APPAdsShow========coming adSource" + adSource.Count);
if (PlayerPrefs.GetInt("ADJUST_FIRSTAD", 0) == 0)
{
LogEventToken(ConstStringKey.ADJUST_FIRSTAD);
PlayerPrefs.SetInt("ADJUST_FIRSTAD", 1);
}
VolcanoReYunJson temp = new VolcanoReYunJson();
temp.eventname = "APP_Ads_Show";
temp.values.Add("Come", aPPAdsShowCome);
@ -337,6 +344,24 @@ public class JoypacAnalyticsManager : MonoBehaviour
#endif
}
static public void DesignEvent_ECPM(double ecpm, string currency, string eventToken)
{
//#if UNITY_ANDROID
//adjust新增事件跟踪收入
AdjustEvent adjustEvent = new AdjustEvent(eventToken);
adjustEvent.setRevenue(ecpm, currency);
Adjust.trackEvent(adjustEvent);
//#endif
}
public void LogEventToken(string _eventToken)
{
if (string.IsNullOrEmpty(_eventToken)) return;
Adjust.trackEvent(new AdjustEvent(_eventToken));
Debug.Log("Joypac LogEventWithLabel Adjust: " + _eventToken);
}
private static bool updateEventToGA = false;
public void Init()
@ -683,6 +708,14 @@ public class JoypacAnalyticsManager : MonoBehaviour
ReceiveAdJustData(json);
// ...
#if JOYPAC_Volcano_OS && UNITY_IOS && !UNITY_EDITOR
JoypacAdjustFinder joypacAdjustFinder = new JoypacAdjustFinder(attribution);
string jsonFinder = JsonUtility.ToJson(joypacAdjustFinder);
Debug.Log(jsonFinder);
JoypacAdClient.Instance.ProfileSet(jsonFinder);
#endif
}
#if DEVELOPMENT_BUILD || ADJUST_TEST
public void EventSuccessCallback(AdjustEventSuccess eventSuccessData)
@ -875,7 +908,38 @@ public class JoypacAdjustAttribution
}
[Serializable]
public class JoypacAdjustFinder
{
[SerializeField]
public string adjust_trackerToken = "";
[SerializeField]
public string adjust_adgroup = "";
[SerializeField]
public string adjust_creative = "";
[SerializeField]
public string adjust_adid = "";
[SerializeField]
public string adjust_clickLabel = "";
[SerializeField]
public string adjust_network = "";
[SerializeField]
public string adjust_trackerName = "";
public JoypacAdjustFinder(AdjustAttribution attribution)
{
adjust_trackerToken = attribution.trackerToken;
adjust_adgroup = attribution.adgroup;
adjust_creative = attribution.creative;
adjust_adid = attribution.adid;
adjust_clickLabel = attribution.clickLabel;
adjust_network = attribution.network;
adjust_trackerName = attribution.trackerName;
}
}

View File

@ -68,6 +68,11 @@ public class RecipeDetailView : MonoBehaviour
{
JoypacAnalyticsManager.Instance.AppOperation(StaticStringsEvent.PlayGame,"", StaticStringsEvent.Make, "", data.id.ToString());
if (PlayerPrefs.GetInt("ADJUST_FIRSTLEVEL", 0) == 0)
{
JoypacAnalyticsManager.Instance.LogEventToken(ConstStringKey.ADJUST_FIRSTLEVEL);
PlayerPrefs.SetInt("ADJUST_FIRSTLEVEL", 1);
}
LocalCacheManager.Save(PopcornGameManager.PanDataTag, panSelector.SelectedPanData.Value);
TransitionManager.Instance.LoadScene(GameScenes.Cooking);

View File

@ -29,6 +29,13 @@ public class FooterManager : MonoBehaviour
{
return;
}
if (PlayerPrefs.GetInt("ADJUST_FIRSTMAINPAGE", 0) == 0)
{
JoypacAnalyticsManager.Instance.LogEventToken(ConstStringKey.ADJUST_FIRSTMAINPAGE);
PlayerPrefs.SetInt("ADJUST_FIRSTMAINPAGE", 1);
}
var gameData = GameDataManager.GameData;
var isTutorial = gameData.FinishedFlags.HasFlag(TutorialFlag.FirstPlay);

View File

@ -34,7 +34,6 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}

View File

@ -751,7 +751,7 @@ PlayerSettings:
webGLWasmStreaming: 0
scriptingDefineSymbols:
1: TextMeshPro
4: TextMeshPro;Notifications;IssuePerson
4: TextMeshPro;Notifications;IssuePerson;JOYPAC_Volcano_OS
7: ANDROID_CN;TextMeshPro;JOYPAC_ReYun;JOYPAC_Volcano
13: TextMeshPro
14: TextMeshPro