添加事件属性,用户属性

This commit is contained in:
juncong lee 2025-09-03 11:45:52 +08:00
parent 6e3974c78f
commit a485b5eaa2
2 changed files with 54 additions and 11 deletions

View File

@ -14,6 +14,11 @@ public class AdjustManager : D_MonoSingleton<AdjustManager>
private string Adid;
private string Gdid;
private string _adNetwork = "_adNetwork";
private string _campaign = "_campaign";
private string _adgroup = "_adgroup";
private string _creative = "_creative";
public void Init()
{
//开始计时
@ -47,8 +52,37 @@ public class AdjustManager : D_MonoSingleton<AdjustManager>
/// <param name="attribution"></param>
private void AttributionChangedDelegate(AdjustAttribution attribution)
{
Debug.Log("Attribution changed");
Debug.Log("Attribution changed network: " + attribution.Network + " campaign: " + attribution.Campaign + " adgroup: " + attribution.Adgroup + " creative: " + attribution.Creative);
AdjustNetwork.Instance.SetNetwork(attribution.Network);
SaveProperties(attribution);
}
private void SaveProperties(AdjustAttribution attribution)
{
PlayerPrefsUtils.SavePlayerPrefsString(_adNetwork, attribution.Network.Substring(0, 10));
PlayerPrefsUtils.SavePlayerPrefsString(_campaign, attribution.Campaign.Substring(0, 20));
PlayerPrefsUtils.SavePlayerPrefsString(_adgroup, attribution.Adgroup.Substring(0, 10));
PlayerPrefsUtils.SavePlayerPrefsString(_creative, attribution.Creative.Substring(0, 20));
}
public static string GetAdNetwork()
{
return PlayerPrefsUtils.GetPlayerPrefsString(AdjustManager.Instance._adNetwork, "");
}
public static string GetCampaign()
{
return PlayerPrefsUtils.GetPlayerPrefsString(AdjustManager.Instance._campaign, "");
}
public static string GetAdgroup()
{
return PlayerPrefsUtils.GetPlayerPrefsString(AdjustManager.Instance._adgroup, "");
}
public static string GetCreative()
{
return PlayerPrefsUtils.GetPlayerPrefsString(AdjustManager.Instance._creative, "");
}
public long GetStartTime()

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using AdjustSdk;
using ThinkingData.Analytics;
using UnityEngine;
namespace WZ
@ -15,6 +16,14 @@ namespace WZ
TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
//如果用户已登录可以设置用户的账号ID作为身份唯一标识
// TDAnalytics.Login("TA");
var properties = new Dictionary<string, object>();
properties.Add("ad_network", AdjustManager.GetAdNetwork());
properties.Add("campaign", AdjustManager.GetCampaign());
properties.Add("adgroup", AdjustManager.GetAdgroup());
properties.Add("creative", AdjustManager.GetCreative());
ShuShuEvent.Instance.UserSet(properties);
AppSDKManager.Instance.SetSuperProperties(properties);
}
}