miduo_client/Assets/ManagedResources/~Lua/Modules/DataCenterService/ThinkingAnalyticsManager.lua

82 lines
1.5 KiB
Lua
Raw Normal View History

2020-06-30 18:59:44 +08:00
ThinkingAnalyticsManager = {}
local this = ThinkingAnalyticsManager
2020-07-13 12:25:55 +08:00
TA_EVENT = {
}
local function _DicToStr(data)
local index = 1
local str = ""
for key, value in pairs(data) do
if index ~= 1 then
str = str .."|"
end
str = str..tostring(value)
end
return str
end
2020-06-30 18:59:44 +08:00
function this.Initialize()
end
2020-07-13 12:25:55 +08:00
-- 设置访客Id
function this.SetDistinctId(distinctId)
if AppConst.isSDK then
App.TAMgr:SetDistinctId(distinctId)
end
end
2020-06-30 18:59:44 +08:00
2020-07-13 12:25:55 +08:00
-- 获取访客Id
function this.GetDistinctId(distinctId)
if AppConst.isSDK then
return App.TAMgr:GetDistinctId(distinctId)
end
return ""
end
-- 登录
function this.Login(accountId)
if AppConst.isSDK then
App.TAMgr:Login(accountId)
end
end
-- 登出
function this.Logout()
if AppConst.isSDK then
App.TAMgr:Logout()
end
end
-- 静态数据设置
local _SuperPropertise = {}
function this.SetSuperProperties(data)
if AppConst.isSDK then
for key, value in pairs(data) do
_SuperPropertise[key] = value
end
local sData = _DicToStr(_SuperPropertise)
App.TAMgr:SetSuperProperties(sData)
end
end
-- 清除静态数据
function this.ClearSuperProperties()
if AppConst.isSDK then
_SuperPropertise = {}
App.TAMgr:ClearSuperProperties()
end
end
2020-06-30 18:59:44 +08:00
2020-07-13 12:25:55 +08:00
-- 打点事件
function this.Track(event, data)
local dStr = _DicToStr(data)
App.TAMgr:Track(event, dStr)
2020-06-30 18:59:44 +08:00
end
return ThinkingAnalyticsManager