添加事件属性,用户属性
This commit is contained in:
parent
6e3974c78f
commit
a485b5eaa2
|
@ -13,42 +13,76 @@ 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()
|
||||
{
|
||||
//开始计时
|
||||
startTime = TimeUtils.GetLocalTimestamp();
|
||||
|
||||
|
||||
AdjustConfig config = new AdjustConfig(StaticValue.AdjustToken, environment);
|
||||
|
||||
|
||||
// 设置归因变更回调函数
|
||||
config.AttributionChangedDelegate = AttributionChangedDelegate;
|
||||
|
||||
|
||||
// (可选)设置其他配置,如日志级别
|
||||
config.LogLevel = AdjustLogLevel.Verbose;
|
||||
|
||||
|
||||
// 初始化Adjust SDK
|
||||
Adjust.InitSdk(config);
|
||||
|
||||
|
||||
//id
|
||||
LoadAdid();
|
||||
LoadGaid();
|
||||
|
||||
|
||||
//计时3分钟
|
||||
AppSDKManager.Instance.Coroutine(AdjustNetwork.Instance.SetOrganic3Min());
|
||||
|
||||
|
||||
ShuShuEvent.Instance.Track("adjust_init");
|
||||
FireBaseAnalyticsManager.Instance.LogEvent("adjust_init");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 归因信息
|
||||
/// </summary>
|
||||
/// <param name="attribution"></param>
|
||||
private void AttributionChangedDelegate(AdjustAttribution attribution)
|
||||
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()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AdjustSdk;
|
||||
using ThinkingData.Analytics;
|
||||
using UnityEngine;
|
||||
namespace WZ
|
||||
|
@ -8,13 +9,21 @@ namespace WZ
|
|||
{
|
||||
public void Init()
|
||||
{
|
||||
LoggerUtils.Debug("ShuShuMangage Init"+StaticValue.TDAppID+" serverURL"+StaticValue.TDServerURL);
|
||||
LoggerUtils.Debug("ShuShuMangage Init" + StaticValue.TDAppID + " serverURL" + StaticValue.TDServerURL);
|
||||
// 初始化SDK
|
||||
TDAnalytics.Init(StaticValue.TDAppID, StaticValue.TDServerURL);
|
||||
//开启自动采集事件
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue