SensorsAnalyticsFlutterPlugin class

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

getDistinctId Future<String?>
no setter
hasAddedFlutterPluginVersion bool
getter/setter pair

Static Methods

bind(String key, String value) Future<void>
绑定业务 ID。key 为业务 ID 的名,value 为业务 ID 的值
clearKeychainData() → void
clearKeychainData 删除当前 keychain 记录 (仅 iOS 使用)
clearSuperProperties() → void
clearSuperProperties 删除本地存储的所有公共属性
clearTrackTimer() → void
clearTrackTimer 清除所有事件计时器
deleteAll() → void
删除本地缓存的全部事件
enableLog(bool enable) → void
设置是否开启 log enable true 表示开启,false 表示关闭
enableNetworkRequest(bool isRequest) → void
设置是否允许请求网络,默认是 true。此方法只针对 Android 平台有效
flush() → void
将所有本地缓存的日志发送到 Sensors Analytics.
getAnonymousId() Future<String>
获取当前用户的匿名 ID
getFlushBulkSize() Future<int>
返回本地缓存日志的最大条目数 默认值为 100 条 在每次调用 track、signUp 以及 profileSet 等接口的时候,都会检查如下条件,以判断是否向服务器上传数据:
getFlushInterval() Future<int>
两次数据发送的最小时间间隔,单位毫秒 默认值为 15 * 1000 毫秒 在每次调用 track、signUp 以及 profileSet 等接口的时候,都会检查如下条件,以判断是否向服务器上传数据:
getLoginId() Future<String?>
获取当前用户的 loginId
getPresetProperties() Future<Map<String, dynamic>?>
返回预置属性
getSuperProperties() Future<Map<String, dynamic>?>
获取事件公共属性
identify(String distinctId) → void
设置当前用户的 distinctId。一般情况下,如果是一个注册用户,则应该使用注册系统内 的 user_id,如果是个未注册用户,则可以选择一个不会重复的匿名 ID,如设备 ID 等,如果 客户没有调用 identify,则使用SDK自动生成的匿名 ID
init({required String? serverUrl, Set<SAAutoTrackType>? autoTrackTypes, Set<SANetworkType>? networkTypes, int flushInterval = 15000, int flushBulkSize = 100, bool enableLog = false, bool javaScriptBridge = false, bool encrypt = false, AndroidConfig? android, IOSConfig? ios, VisualizedConfig? visualized, bool heatMap = false, Map? globalProperties}) Future<void>
初始化神策 SDK。 用户需要尽可能早的调用该初始化方法,建议在 main() 方法中,不过至少要保证 Flutter 项目这段代码执行完毕:
isAutoTrackEventTypeIgnored(SAAutoTrackType type) Future<bool>
判断全埋点类型是否被忽略
isNetworkRequestEnable() Future<bool>
是否请求网络,默认是 true。此方法只针对 Android 平台有效
itemDelete(String itemType, String itemId) → void
删除 item
itemSet(String itemType, String itemId, [Map<String, dynamic>? properties]) → void
设置 item
login(String loginId, [Map<String, dynamic>? properties]) → void
login. 用户登陆 @param loginId 用户登录 ID.
loginWithKey(String loginKey, String loginValue, [Map<String, dynamic>? properties]) Future<void>
设置当前用户的登陆 ID。loginKey 是登录 id 名,loginValue 是登录的值,properties 用户登录属性
logout() → void
logout 用户登出
profileAppend(String profileProperty, List<String> content) → void
profileAppend 给一个 List 类型的 Profile 增加一些值
profileDelete() → void
profileDelete 删除当前用户的所有记录
profileIncrement(String profileProperty, num number) → void
profileIncrement 给一个数值类型的Profile增加一个数值. 只能对数值型属性进行操作,若该属性未设置,则添加属性并设置默认值为0
profilePushId(String pushTypeKey, String pushId) → void
保存用户推送 ID 到用户表
profileSet(Map<String, dynamic> profileProperties) → void
profileSet 设置用户属性值
profileSetOnce(Map<String, dynamic> profileProperties) → void
profileSetOnce 设置用户属性值,与 profileSet 不同的是:如果之前存在,则忽略,否则,新创建.
profileUnset(String profileProperty) → void
profileUnset 删除一个用户属性.
profileUnsetPushId(String pushTypeKey) → void
删除用户设置的 pushId
registerSuperProperties(Map<String, dynamic> superProperties) → void
registerSuperProperties 设置公共属性
removeTimer(String eventName) → void
删除事件的计时器
setFlushBulkSize(int flushBulkSize) → void
设置本地缓存日志的最大条目数,最小 50 条 flushBulkSize 时间间隔,单位毫秒
setFlushInterval(int flushInterval) → void
设置两次数据发送的最小时间间隔 flushInterval 时间间隔,单位毫秒
setFlushNetworkPolicy(Set<SANetworkType> networkType) → void
设置 flush 时网络发送策略,默认 3G、4G、5G、WI-FI 环境下都会尝试 flush
setServerUrl(String serverUrl, [bool isRequestRemoteConfig = false]) → void
设置当前 serverUrl serverUrl 当前 serverUrl isRequestRemoteConfig 是否立即请求当前 serverUrl 的远程配置,默认是 false
track(String eventName, Map<String, dynamic>? properties) → void
track 事件追踪
trackAppInstall([Map<String, dynamic>? properties, bool disableCallback = false]) → void
记录 $AppInstall 事件,用于在 App 首次启动时追踪渠道来源,并设置追踪渠道事件的属性。 注意:如果之前使用 trackInstallation 触发的激活事件,需要继续保持原来的调用,无需改成 trackAppInstall,否则会导致激活事件数据分离。 这是 Sensors Analytics 进阶功能,请参考文档 https://sensorsdata.cn/manual/track_installation.html
trackInstallation(String eventName, Map<String, dynamic>? properties) → void
trackInstallation App 激活事件追踪
trackTimerEnd(String eventName, Map<String, dynamic>? properties) → void
trackTimerEnd 计时结束
trackTimerPause(String eventName) → void
暂停事件计时器,计时单位为秒。
trackTimerResume(String eventName) → void
恢复事件计时器,计时单位为秒。
trackTimerStart(String eventName) Future<String>
初始化事件的计时器,计时单位为秒。
trackViewScreen(String url, Map<String, dynamic>? properties) → void
trackViewScreen 页面浏览
unbind(String key, String value) Future<void>
解绑业务 ID。key 为业务 ID 的名,value 为业务 ID 的值
unregisterSuperProperty(String superProperty) → void
unregisterSuperProperty 删除一个指定的公共属性.

Constants

FLUTTER_PLUGIN_VERSION → const String