feat(saas): SaaS 无埋点采集与可视化圈选支持 - #41
Merged
Merged
Conversation
YoloMao
force-pushed
the
feat/saas_autotrack
branch
3 times, most recently
from
April 3, 2026 03:40
ff80a8a to
1595d53
Compare
YoloMao
force-pushed
the
feat/saas_autotrack
branch
from
April 9, 2026 07:50
1595d53 to
c804c54
Compare
YoloMao
force-pushed
the
feat/saas_autotrack
branch
from
April 22, 2026 08:48
4258f0f to
34604a8
Compare
- Enable autotrack for SaaS mode (remove early return, add to xpath/page logic) - Add SaaS_OTHER event sender for VIEW_CLICK/VIEW_CHANGE events via /harmonyos/other - Merge click/change events by page context (t/u/s/d/p/ptm/r) before sending, consistent with iOS SaaS SDK behavior - Add VIEW_CLICK/VIEW_CHANGE serialization in MeasurementProtocol V2 format (clck/chng) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Handle clck/chng events in SaaSHybridEventHandler, forwarding hybrid autotrack click/change events from _vds_bridge to SaaS_OTHER sender - Add query/hyperlink fields to ViewElementEvent for SaaS serialization - Add native page path (p) to _vds_hybrid_native_info injection, aligned with iOS SaaS SDK Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Hybrid.saasCircleEnabled flag, managed by Circle on WebSocket open/close - Add Hybrid.onPageEnd to inject vds_web_circle_plugin.min.js when circle active - Compute and inject _vds_hybrid_native_info.x (WebView native XPath) via getAttachedFrameNodeById + AutotrackClick.getXpathInfo - Add GrowingAnalytics.onPageEnd public API - Add Plugins.onWebViewSaaSCircleEvent dispatch for SaaS circle events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…DME_SaaS - Hybrid.onPageEnd now checks hybridAutotrackEnabled before injecting circle plugin - README_SaaS: add autotrackEnabled/autotrackAllPages config items - README_SaaS: update createHybridProxy signature with webviewId param - README_SaaS: add onPageEnd API and update Hybrid examples with webviewId Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e changes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SourceTree uses system Python 3.9 which doesn't support `X | Y` union type syntax in annotations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ViewElementEvent: SaaS mode now sets pageShowTimestamp (same as CDP) - Context: SaaS mode now creates 3 EventSenders (PV + CSTM + OTHER) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Util.test.ets: add 19 cases for VIEW_CLICK/VIEW_CHANGE branch in toSerializeByMeasurementProtocolV2 (clck/chng t field, q/h/idx/v optional field omission, lat/lng, r network state, base fields) - ViewElementEvent.test.ets: add query/hyperlink field tests; fix stale comment (pageShowTimestamp now covers SaaS in addition to CDP) - Network.test.ets: add SaaS OTHER (/harmonyos/other) URL path test Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Context.md: SaaS now initializes 3 EventSenders (PV/CSTM/OTHER) - Network.md: add mergeSaaSClick param to generateRequest/processEvents signatures; add /harmonyos/other to URL path table - AnalyticsCore.md: add onPageEnd() to SaaS special methods section - Event.md: add SaaS_OTHER to EventSenderType; add /harmonyos/other URL; add query/hyperlink fields to ViewElementEvent; document click merge format - GrowingAnalytics.md: add onPageEnd() API to Hybrid section - Plugins.md: add onWebViewSaaSCircleEvent to PluginsInterface and callback table - Utils.md: expand toSerializeByMeasurementProtocolV2 field mapping to cover VIEW_CLICK/VIEW_CHANGE branch with all output fields Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
删除与 CLAUDE.md 重复的"产品与使命"、无可行动信息的"持续积累的知识域"、 与核心职责高度重叠的"进阶能力"及 agent 自指注释,减少约 46% token 消耗。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- correct SaaS Hybrid WebView circle coordinate transform (server vp → device physical px via vp2px / px2vp) - add SaaSDemo.html and entry Hybrid demo wiring - add unit tests for circle protocol/elements and ViewElementEvent - review and sync module docs with SaaS autotrack changes (fix Snappy/XOR, SaaS circle pipeline, mergeSaaSClick, dead links) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Release builds enable property obfuscation. With byteCodeHar=true the property obfuscation is deferred to the consumer (entry) build, so the hybrid JavaScriptProxy method names (registerJavaScriptProxy methodList) were renamed while the methodList string literals and the web SDK calls kept the original names. The mismatch made the native bridge methods unreachable (webview "FindMethod fail"), so the hybrid page sent zero events in release. Add the NewSaaS (GrowingWebViewJavascriptBridge) and SaaS (_vds_bridge) bridge method names to -keep-property-name in both consumer-rules.txt (the file that actually governs the entry release build) and obfuscation-rules.txt (kept in sync). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Append a timestamp query param to the circle wss URL and attach an
`Authorization: Sign SHA1 <sig>` header in SaaS mode, where the
signature is SHA1("<path>:<ts>") as a lowercase hex string. NewSaaS /
CDP and MobileDebugger connections are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- parse circle回跳 URL params by mode (circleType/wsHost/circleRoomNumber for SaaS) - build wsUrl from wsHost + accountId + circleRoomNumber in SaaS mode - fix sha1 input encoding via TextEncoder - allow list index 0 in CircleElement - document URL Scheme setup and et 指令类型 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Authorization (signed WSS header) and _SaaSEventData fields x/v/p/tl are renamed by property obfuscation, breaking SaaS circle auth and click/page snapshot triggering. Add them to keep rules and extend the obfuscation checker to monitor Circle/SaaSModel/WebSocket via JSON.parse-cast and known-header extractors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
YoloMao
force-pushed
the
feat/saas_autotrack
branch
from
June 24, 2026 08:01
d62687c to
afa3dcb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 为 SaaS 模式补齐两大能力:无埋点采集(原生 + Hybrid 的点击 / 输入变更 / 页面浏览)与可视化圈选(扫码圈选原生页面 + Hybrid 页面)。完成后 SaaS 模式在采集与圈选层面与 New SaaS / CDP 对齐,并与 iOS / Android SaaS SDK 的协议保持一致。
一、SaaS 无埋点采集
原生采集
clck)、输入变更(chng)、页面浏览(PAGE)采集,xpath / page 生成逻辑复用 CDP(PATH_SEPARATOR + node[xcontent]格式)。/harmonyos/other),事件按 MeasurementProtocol V2 序列化为clck/chng。t/u/s/d/p/ptm/r一致)的多条点击事件在 JSON 序列化阶段合并为一条(mergeSaaSClick):公共字段提升至顶层,元素专属字段(x/v/idx/h/gesid/esid)收入e数组,降低上报体积,与 iOS SaaS 行为一致。Hybrid 采集
clck/chng事件经_vds_bridge上报后,由 SDK 解析元素信息(xpath、textValue、index、hyperlink)并拼接原生页面路径前缀后入库上报。接入方使用方式(README_SaaS)
autotrackEnabled(默认false)、autotrackAllPages(默认false)。onWindowStageCreate中调用GrowingAnalytics.onWindowStageCreate(...);仅配置开关而不注册监听不会产生事件。growing_alias/growing_title/growing_attributes设置页面别名 / 标题 / 属性(Navigation 与 @ohos.router 两种导航方式)。二、SaaS 可视化圈选
圈选入口(URL Scheme 回跳)
module.json5配置 URL Scheme,并在EntryAbility的onCreate/onNewWant中调用GrowingAnalytics.handleOpenURL(uri)。circleType/wsHost/circleRoomNumber,由wsHost + accountId + circleRoomNumber拼接圈选 wss 地址并建连。连接签名
timestamp查询参数,并附带Authorization: Sign SHA1 <sig>头,其中sig = SHA1("<path>:<timestamp>")的小写 hex。New SaaS / CDP 与 MobileDebugger 连接不受影响。圈选数据上报
UserAction协议(refresh/click/page),携带页面信息、截图、impress元素列表及命中的targets,相关模型集中在新增的mobileDebugger/SaaSModel.ets。Hybrid 圈选
GrowingAnalytics.onPageEnd(controller, webviewId?),接入方在 WebViewonPageEnd回调中调用。圈选激活时动态注入圈选脚本(vds_web_circle_plugin.min.js),并通过runJavaScript把 WebView 所在的原生 xpath 写入window._vds_hybrid_native_info,供 Web 侧定位。createHybridProxy增加可选webviewId参数,配合 Web 控件.id(webviewId)支持多 WebView 圈选。FrameNode布局矩形命中目标 WebView 并做坐标系转换(server vp → device px)后定向转发,无坐标则广播给所有已注册 WebView,最终转发给 Web 侧_vds_hybrid.helper.handleWebEvent()。PluginsInterface.onWebViewSaaSCircleEvent(message, webviewId?),由核心模块内的Circle圈选插件消费(Hybrid收到 Web 侧圈选事件 →Plugins广播 →Circle转发给服务端)。三、配套修复与改动
GrowingWebViewJavascriptBridge、SaaS 的_vds_bridge)加入consumer-rules.txt/obfuscation-rules.txt的-keep-property-name,修复 release 包属性混淆导致原生桥方法不可达(webviewFindMethod fail)、Hybrid 页面零事件的问题。query/hyperlink字段;SaaS 模式补齐pageShowTimestamp;index 在非 New SaaS 模式下允许0。四、公开 API / 配置变更(接入方可见)
GrowingAnalytics.onPageEnd(controller, webviewId?)onPageEnd时调用createHybridProxy(controller, webviewId?)webviewId参数config.autotrackEnabledconfig.autotrackAllPagesPluginsInterface.onWebViewSaaSCircleEventTest Plan
clck,xpath 格式正确chng;页面浏览上报PAGEautotrackAllPages=true时全页面自动上报;growing_alias/title/attributes生效mergeSaaSClick:同页面多条点击合并为单条 JSON,e数组元素个数正确handleOpenURL正确解析并建立圈选 wss 连接timestamp及Authorization: Sign SHA1头,服务端验签通过refresh/click/pageUserAction 及截图、impress 元素onPageEnd后圈选脚本成功注入,native xpath 写入正确dataCollectionEnabled=false时上述事件均不上报🤖 Generated with Claude Code