using System.Collections.Generic; using System.Linq; using ThinkingData.Analytics; namespace WZ { public class ShuShuEvent : D_MonoSingleton { /// /// 设置用户属性 /// public void UserSet(Dictionary dic) { TDAnalytics.UserSet(dic); } /// /// 设置公共事件属性 /// /// public void SetSuperProperties(Dictionary superProperties) { TDAnalytics.SetSuperProperties(superProperties);//设置公共事件属性 } /// /// 发送事件 /// public void Track(string eventName) { TDAnalytics.Track(eventName); } /// /// 发送事件 /// public void Track(string eventName, string key1, object value1) { var extraInfo = new Dictionary(); if (key1 != null && value1 != null) { extraInfo[key1] = value1; } Track(eventName, extraInfo); } /// /// 发送事件 /// public void Track(string eventName, Dictionary properties) { TDAnalytics.Track(eventName, properties); } /// /// 发送事件 /// public void Track(string eventName, Dictionary properties) { var newProperties = properties.ToDictionary( pair => pair.Key, pair => (object)pair.Value ); TDAnalytics.Track(eventName, newProperties); } /// /// 数数收益上报 /// /// 聚合平台名称 /// 广告平台名称 /// 广告位ID /// 广告格式 /// 单次展示收益 /// 广告展示点位 /// 第几次展示该格式的广告 public void OnAdRevenueEvent(string ad_platform, string ad_source, string ad_unit_name, string ad_format, double revenue, string position, int number) { Dictionary properties = new Dictionary(); properties.Add("ad_platform", ad_platform); properties.Add("ad_source", ad_source); properties.Add("ad_unit_name", ad_unit_name); properties.Add("ad_format", ad_format); properties.Add("value", revenue); properties.Add("currency", "USD"); properties.Add("position", position); properties.Add("number", number); TDAnalytics.Track("ad_impression", properties); } } }