@tripo3d/lens / index / TrackingPlugin
Class: TrackingPlugin
Defined in: src/plugins/tracking/index.ts:57
行为埋点插件(L3,opt-in):命令式 API + 声明式 data-trace* 自动采集 + Auto PageView + Dwell 标记。 只 emit RawEvent(fire-and-forget),不直发请求、不 import 其它插件;无 DOM(小程序/RN/SSR)自动禁声明式+曝光、留命令式。
Implements
Constructors
Constructor
new TrackingPlugin(opts?): TrackingPlugin;Defined in: src/plugins/tracking/index.ts:81
Parameters
| Parameter | Type |
|---|---|
opts? | { autoTrack?: boolean | AutoTrackOptions; } |
opts.autoTrack? | boolean | AutoTrackOptions |
Returns
TrackingPlugin
Properties
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
name | readonly | "tracking" | 'tracking' | 插件唯一名,重复注册报错 | src/plugins/tracking/index.ts:58 |
requiredConsent | readonly | "tracking" | undefined | 受 Consent tracking 维度管控 | src/plugins/tracking/index.ts:60 |
Methods
setup()
setup(ctx): void;Defined in: src/plugins/tracking/index.ts:90
注册激活:Core 在 init 时调用
Parameters
| Parameter | Type |
|---|---|
ctx | PluginContext |
Returns
void
Implementation of
teardown()
teardown(): void;Defined in: src/plugins/tracking/index.ts:146
注销清理:destroy 时调用
Returns
void
Implementation of
track()
track(event, properties?): void;Defined in: src/plugins/tracking/index.ts:168
自定义事件:事件名必须为合法 TracePath(. 分隔 2-8 段),非法坐标 reportError 丢弃、不发脏事件
Parameters
| Parameter | Type |
|---|---|
event | string |
properties? | Record<string, unknown> |
Returns
void
expo()
expo(path, properties?): void;Defined in: src/plugins/tracking/index.ts:184
命令式曝光(TracePath 坐标)
Parameters
| Parameter | Type |
|---|---|
path | string |
properties? | Record<string, unknown> |
Returns
void
click()
click(path, properties?): void;Defined in: src/plugins/tracking/index.ts:189
命令式点击(TracePath 坐标)
Parameters
| Parameter | Type |
|---|---|
path | string |
properties? | Record<string, unknown> |
Returns
void
pageview()
pageview(properties?): void;Defined in: src/plugins/tracking/index.ts:194
手动 PageView(autoTrack 关也可用);仅可附带 properties,页面身份由 L4 注入 context
Parameters
| Parameter | Type |
|---|---|
properties? | Record<string, unknown> |
Returns
void
trackImpression()
trackImpression(selector, opts): void;Defined in: src/plugins/tracking/index.ts:199
注册一批选择器命中的元素做曝光上报:进视口越过 threshold 才报,once 控元素级去重。仅观察调用时已存在的元素(动态新增改用声明式 data-trace*)
Parameters
| Parameter | Type |
|---|---|
selector | string |
opts | ImpressionOptions |
Returns
void
setExposurePolicy()
setExposurePolicy(policy): void;Defined in: src/plugins/tracking/index.ts:226
运行时设置曝光策略(优先级高于 Remote Config;建议在元素登记前调用)
Parameters
| Parameter | Type |
|---|---|
policy | ExposePolicyConfig |
Returns
void