chicken_dy/Assets/HCMiniSdk/Scripts/WebGL/HCWX/HCWXAnalytics.cs

28 lines
845 B
C#
Raw Normal View History

2024-03-07 12:12:48 +00:00
#if UNITY_WEBGL && WEBGL_WX
using System.Collections.Generic;
using LitJson;
using WeChatWASM;
namespace HC
{
public class HCWXAnalytics : HCIAnalytics
{
public void TrackEvent(string eventName, Dictionary<string, object> eventDic = null)
{
eventDic ??= new Dictionary<string, object>();
var json = JsonMapper.ToJson(eventDic);
HCDebugger.LogDebug($"[HCWXAnalytics] [TrackEvent] eventName {eventName} json = {json}");
Dictionary<string, object> umeng = new Dictionary<string, object>();
umeng["cmd"] = "umeng";
umeng["eventName"] = eventName;
umeng["data"] = eventDic;
HCWxTools.Instance.UnityToWxMiniGame(umeng);
#if !UNITY_EDITOR
WX.ReportEvent(eventName.ToLower(), eventDic);
#endif
}
}
}
#endif