Mobile Development 18 min read

Exploring Automated Visual Event Tracking (埋点) for iOS Applications

This article examines the challenges of traditional code‑based event tracking in iOS, compares code, visual, and no‑tracking approaches, and presents a visual‑tracking solution that uses AOP, unique identifiers, data‑carrying protocols, and version management to improve automation and maintainability.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Exploring Automated Visual Event Tracking (埋点) for iOS Applications

In the data‑driven era, every user action influences business decisions, making event tracking (埋点) essential for iOS apps. Traditional code‑based tracking suffers from coupling, release delays, and maintenance difficulty.

The article classifies tracking solutions into three categories: code tracking, visual (click‑selection) tracking, and no‑tracking (full‑capture). Code tracking is simple and flexible but introduces the problems listed above; visual tracking adds a layer that captures events through a UI selector; no‑tracking captures all events but creates massive data and cleaning overhead.

After evaluating the drawbacks of code tracking, the authors adopt a visual‑tracking approach, embedding a visual‑tracking SDK in the app. When the selector switch is enabled, a floating button allows analysts to click UI elements, automatically generating a configuration view that records a unique identifier, event ID, and selectable data fields.

The technical core relies on Aspect‑Oriented Programming (AOP) and Runtime method swizzling to hook common actions such as UIApplication.sendAction , intercepting button clicks, table view selections, and gesture events. Two main modules are discussed:

Unique Identifier : Instead of unstable viewPath, the solution uses a combination of target + action, optionally extended with a custom protocol to handle conditional logic.

Data Carrying : A protocol lets targets or view controllers provide a dictionary of page, event, and extra parameters, enabling the SDK to fetch required values during reporting.

Version Management : The SDK can enumerate all UI elements, compare generated identifiers with stored configurations, and mark obsolete entries, reducing manual cleanup across app versions.

The article concludes that while visual tracking alleviates many pain points of code tracking, challenges remain in handling conditional events and data transformation. Continued research is needed to achieve fully automated, efficient event tracking for mobile applications.

iOSAutomationAOPvisual trackingevent trackingmobile analytics
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.