Skip to content

@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 ​

ts
new TrackingPlugin(opts?): TrackingPlugin;

Defined in: src/plugins/tracking/index.ts:81

Parameters ​

ParameterType
opts?{ autoTrack?: boolean | AutoTrackOptions; }
opts.autoTrack?boolean | AutoTrackOptions

Returns ​

TrackingPlugin

Properties ​

PropertyModifierTypeDefault valueDescriptionDefined in
namereadonly"tracking"'tracking'插件唯一名,重复注册报错src/plugins/tracking/index.ts:58
requiredConsentreadonly"tracking"undefined受 Consent tracking 维度管控src/plugins/tracking/index.ts:60

Methods ​

setup() ​

ts
setup(ctx): void;

Defined in: src/plugins/tracking/index.ts:90

注册激活:Core 在 init 时调用

Parameters ​

ParameterType
ctxPluginContext

Returns ​

void

Implementation of ​

TracePlugin.setup


teardown() ​

ts
teardown(): void;

Defined in: src/plugins/tracking/index.ts:146

注销清理:destroy 时调用

Returns ​

void

Implementation of ​

TracePlugin.teardown


track() ​

ts
track(event, properties?): void;

Defined in: src/plugins/tracking/index.ts:168

自定义事件:事件名必须为合法 TracePath(. 分隔 2-8 段),非法坐标 reportError 丢弃、不发脏事件

Parameters ​

ParameterType
eventstring
properties?Record<string, unknown>

Returns ​

void


expo() ​

ts
expo(path, properties?): void;

Defined in: src/plugins/tracking/index.ts:184

命令式曝光(TracePath 坐标)

Parameters ​

ParameterType
pathstring
properties?Record<string, unknown>

Returns ​

void


click() ​

ts
click(path, properties?): void;

Defined in: src/plugins/tracking/index.ts:189

命令式点击(TracePath 坐标)

Parameters ​

ParameterType
pathstring
properties?Record<string, unknown>

Returns ​

void


pageview() ​

ts
pageview(properties?): void;

Defined in: src/plugins/tracking/index.ts:194

手动 PageView(autoTrack 关也可用);仅可附带 properties,页面身份由 L4 注入 context

Parameters ​

ParameterType
properties?Record<string, unknown>

Returns ​

void


trackImpression() ​

ts
trackImpression(selector, opts): void;

Defined in: src/plugins/tracking/index.ts:199

注册一批选择器命中的元素做曝光上报:进视口越过 threshold 才报,once 控元素级去重。仅观察调用时已存在的元素(动态新增改用声明式 data-trace*)

Parameters ​

ParameterType
selectorstring
optsImpressionOptions

Returns ​

void


setExposurePolicy() ​

ts
setExposurePolicy(policy): void;

Defined in: src/plugins/tracking/index.ts:226

运行时设置曝光策略(优先级高于 Remote Config;建议在元素登记前调用)

Parameters ​

ParameterType
policyExposePolicyConfig

Returns ​

void

基于 MIT 协议发布(内部使用)