数据采集API
API列表
无埋点SDK API列表一览
GrowingAutotracker.get().setDataCollectionEnabled(true)
GrowingAutotracker.get().setLoginUserId("userId")
GrowingAutotracker.get().setLoginUserId("userId","userKey")
GrowingAutotracker.get().cleanLoginUserId()
GrowingAutotracker.get().setLocation(20.11,20.11)
GrowingAutotracker.get().cleanLocation()
GrowingAutotracker.get().trackCustomEvent("eventName")
GrowingAutotracker.get().setLoginUserAttributes(new HashMap<>())
GrowingAutotracker.get().getDeviceId()
GrowingAutotracker.get().bridgeWebView(webview)
GrowingAutotracker.get().trackTimerStart("timer")
GrowingAutotracker.get().trackTimerPause("timerId")
GrowingAutotracker.get().trackTimerResume("timerId")
GrowingAutotracker.get().trackTimerEnd("timerId")
GrowingAutotracker.get().removeTimer("timerId")
GrowingAutotracker.get().clearTrackTimer()
GrowingAutotracker.get().doDeepLinkByUrl("Your DeepLinkUrl", new DeepLinkCallback())
GrowingAutotracker.get().registerComponent(module,<config>)
GrowingAutotracker.get().setGeneralProps(new HashMap<>())
GrowingAutotracker.get().removeGeneralProps("key1", "key2")
GrowingAutotracker.get().clearGeneralProps()
GrowingAutotracker.get().autotrackPage(activity, "alias", new HashMap<>())
GrowingAutotracker.get().autotrackPage(androidx.fragment.app.Fragment, "alias", new HashMap<>())
GrowingAutotracker.get().autotrackSystemPage(android.app.Fragment, "alias", new HashMap<>())
GrowingAutotracker.get().autotrackSupportPage(android.support.v4.app.Fragment, "alias", new HashMap<>())
GrowingAutotracker.get().setPageAttributes(activity, new HashMap<>())
GrowingAutotracker.get().setPageAttributes(androidx.fragment.app.Fragment, new HashMap<>())
GrowingAutotracker.get().setPageAttributesSystem(android.app.Fragment, new HashMap<>())
GrowingAutotracker.get().setPageAttributesSupport(android.support.v4.app.Fragment, new HashMap<>())
GrowingAutotracker.get().trackViewImpression(view, "ViewShowed")
GrowingAutotracker.get().stopTrackViewImpression(view)
GrowingAutotracker.get().setUniqueTag(button, "UniqueTagName")
GrowingAutotracker.get().ignoreView(view, IgnorePolicy.IGNORE_SELF)
GrowingAutotracker.get().ignoreViewClick(view, true)
GrowingAutotracker.get().trackEditText(editText, true)
埋点SDK API列表一览
GrowingTracker.get().setDataCollectionEnabled(true)
GrowingTracker.get().setLoginUserId("userId")
GrowingTracker.get().setLoginUserId("userId", "userKey")
GrowingTracker.get().cleanLoginUserId()
GrowingTracker.get().setLocation(20.11, 20.11)
GrowingTracker.get().cleanLocation()
GrowingTracker.get().trackCustomEvent("eventName")
GrowingTracker.get().setLoginUserAttributes(new HashMap<>())
GrowingTracker.get().getDeviceId()
GrowingTracker.get().bridgeWebView(webview)
GrowingTracker.get().trackTimerStart("timer")
GrowingTracker.get().trackTimerPause("timerId")
GrowingTracker.get().trackTimerResume("timerId")
GrowingTracker.get().trackTimerEnd("timerId")
GrowingTracker.get().removeTimer("timerId")
GrowingTracker.get().clearTrackTimer()
GrowingTracker.get().doDeepLinkByUrl("Your DeepLinkUrl", new DeepLinkCallback())
GrowingTracker.get().registerComponent(module,<config>)
GrowingTracker.get().setGeneralProps(new HashMap<>())
GrowingTracker.get().removeGeneralProps("key1", "key2")
GrowingTracker.get().clearGeneralProps()
通用 API 详细说明
无埋点SDK和埋点SDK中都可以使用通用API,唯一的区别在于调用的主体不同,比如说在配置SDK模块的接口上:
无埋点SDK示例代码:
GrowingAutotracker.get().registerComponent(module,<config>)
埋点SDK示例代码:
GrowingTracker.get().registerComponent(module,<config>)
1. 数据采集开关
setDataCollectionEnabled
打开或关闭数据采集
参数说明
参数 | 参数类型 | 说明 |
---|---|---|
enabled | boolean | true 打开数据采集,false 关闭数据采集,默认 true |
示例
无埋点SDK示例代码:
GrowingAutotracker.get().setDataCollectionEnabled(true)
埋点SDK示例代码:
GrowingTracker.get().setDataCollectionEnabled(true)
2. 设置登录用户ID
setLoginUserId
当用户登录之后调用,设置登录用户ID
info
-
如果您的App每次用户升级版本时无需重新登录的话,为防止用户本地缓存被清除导致的无法被识别为登录用户,建议在用户每次升级App版本后初次访问时重新调用setLoginUserId方法
-
当需要标记用户ID类型时,请先进行规划,并在平台的数据中心,添加新的用户身份类型,再设置userkey,误设会影响数据质量。 同时在初始化 SDK 时设置
setIdMappingEnabled
为true
参数说明
参数 | 参数类型 | 说明 |
---|---|---|
userId | String | 长度限制大于0且小于等于1000,如果大于长度1000将只截取前1000长度 |
userKey | String | 适用于ID-MAPPING,可设置 userId 的类型, 默认不传 |
示例
无埋点SDK示例代码:
GrowingAutotracker.get().setLoginUserId("112333445")
GrowingAutotracker.get().setLoginUserId("112333445","phone")
埋点SDK示例代码:
GrowingTracker.get().setLoginUserId("112333445")
GrowingTracker.get().setLoginUserId("112333445","phone")
3. 清除登录用户ID
cleanLoginUserId
当用户登出之后调用,清除已经设置的登录用户ID。
示例
无埋点SDK示例代码:
GrowingAutotracker.get().cleanLoginUserId()
埋点SDK示例代码:
GrowingTracker.get().cleanLoginUserId()