Design and Implementation of JD Daojia Precise Exposure Tracking System
This document details the background, architecture, new precise exposure system, technical challenges, iOS implementation, visualization tools, and achieved results of JD Daojia's mobile data‑tracking platform, highlighting how a three‑layer design and automated validation improve accuracy, reduce development cost, and streamline testing.
Background and Goals
Describes the current JD Daojia data tracking workflow consisting of four steps: collecting requirements, developing according to templates, manual log verification, and data back‑trace validation, highlighting issues such as low accuracy, high development cost, and invasive code.
Tracking System Architecture
Introduces a three‑layer architecture: Adaptation layer (unifies API for different app modules), Validation layer (AOP‑based verification against requirement templates), and Service layer (precise exposure, aggregation, file upload). Shows diagrams of component separation.
New Precise Exposure System
Details the shortcomings of the previous exposure system (large code footprint, lack of ratio/duration checks, coarse granularity, low efficiency, no cloud configuration) and presents the new design that filters duplicate exposures, integrates view actions, supports configurable ratios/durations, and adds aggregation/upload services.
Technical Challenges
Lists challenges such as handling diverse scroll containers, managing strong/weak references to avoid lifecycle leaks, and minimizing performance impact by filtering invisible views before frame calculations.
iOS Implementation
Shows Objective‑C/Swift‑style API for adding EP views with unique IDs, user actions, containers, visible rect and callbacks, wrapped in /// 添加ep进入追踪 需要传入该资源位唯一识别码 /// 适用场景:刷新之后,刷了模型,但是资源位没变化,不需要重新报的场景 /// @param epView 需要追踪的epView /// @param epUID epUID为该资源位唯一识别码,只要这个码不变,并且在屏幕内,即使多次添加不会再次回调 /// @param userAction 与此epview绑定的数据model的userAction /// @param containers 底部需要追踪的滚动容器 /// @param visibleRect 需要曝光的可视区域 坐标系相对于UIWindow /// @param callback 埋点回调,此处需要手动去处理数据拼接以及埋点 - (void)addEPView:(UIView *)epView epUniqueID:(NSString *)epUID userAction:(NSString *)userAction containers:(NSArray<UIView *> *)containers visibleRect:(CGRect)visibleRect epEventCallback:(void (^)(UIView * _Nonnull epView))callback; /// 添加ep进入追踪 需要传入数据Model /// 适用场景:刷新之后,模型发生了改变并且需要重新曝光的场景 /// @param epView 需要追踪的epView /// @param model 与此epview绑定的数据model,模型一旦发生改变(对同一个资源位来说模型地址发生变化),则会再次触发回调 /// @param userAction 与此epview绑定的数据model的userAction /// @param containers 底部需要追踪的滚动容器 /// @param visibleRect 需要曝光的可视区域 坐标系相对于UIWindow /// @param callback 埋点回调,此处需要手动去处理数据拼接以及埋点 - (void)addEPView:(UIView *)epView model:(NSObject *)model userAction:(NSString *)userAction containers:(NSArray<UIView *> *)containers visibleRect:(CGRect)visibleRect epEventCallback:(void (^)(UIView * _Nonnull epView))callback; and explains the use of KVO and proxy observers to track view changes without manual deregistration.
Visualization and Validation
Describes visual debugging where exposure states are colored (red = added, yellow = exposed, green = reported), on‑screen labels show report counts, and a log viewer provides searchable, filterable event lists. Also mentions integration with the Tianhe template system for automatic data verification.
Results and Outlook
Reports 80 % page coverage, 15 % redundant point reduction, accuracy improvement from 90 % to 98 %, code reduction from ~50 lines to 1 line per point, and a 60 % cut in testing time. Future work includes extending to H5/RN, achieving 100 % accuracy, and further simplifying the API.
Dada Group Technology
Sharing insights and experiences from Dada Group's R&D department on product refinement and technology advancement, connecting with fellow geeks to exchange ideas and grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.