Mobile Development 19 min read

Exploring iOS Automated Visual Event Tracking (埋点) – Technical Overview

This article examines the challenges and solutions of implementing automated visual event tracking (埋点) in iOS applications, covering background, existing methods, the proposed visual tracking architecture, unique identifier generation, data payload handling, version management, and future considerations for improving development efficiency.

JD Tech
JD Tech
JD Tech
Exploring iOS Automated Visual Event Tracking (埋点) – Technical Overview

Preface

In the data‑driven era, every user action—from page views to clicks, revisits, and purchases—affects decision‑making. Event tracking (埋点) bridges the gap between users and developers, and automated visual tracking has become popular for solving many problems of traditional code‑based tracking.

Background

Data collection is crucial for accurate analysis. Companies adopt three main tracking approaches: code‑based tracking, visual (point‑and‑click) tracking, and no‑tracking (full‑capture). Code tracking is simple and flexible but tightly couples tracking code with business logic, leading to maintenance overhead.

Visual tracking aims to reduce manual coding by providing a UI layer that generates configuration for events, while full‑capture (no‑tracking) creates massive data volumes and is rarely chosen.

Overall Overview

The article first presents a product prototype overview, then dives into technical principles, and finally discusses key modules such as unique identifier generation, data carrying, and version management.

Product Prototype Overview

An SDK is embedded in the app. When the visual‑tracking switch is turned on, a floating button appears. Clicking any UI element opens a configuration view where the SDK captures a unique identifier, event ID, and selected data fields. Collected configurations are uploaded to a server and later used at runtime to automatically report events.

Technical Principle Overview

The SDK uses Aspect‑Oriented Programming (AOP) with Runtime Method Swizzling to hook common methods (e.g., UIApplication.sendAction ) and intercept user interactions. Hooked methods retrieve the stored configuration and perform the actual data upload.

Key Module Implementation

Unique Identifier

Most visual‑tracking solutions generate a viewPath (a tree‑based path like 0‑1‑0) to identify a view. This approach fails when view hierarchies change. The article proposes using the more stable target+action pair, which remains constant regardless of layout changes. For conditional events, a protocol method can append extra qualifiers to the identifier.

Data Carrying

Event payloads often need page parameters, event parameters, and extra parameters. The SDK defines a protocol that returns a dictionary of key‑value pairs from the target or controller, allowing the visual‑tracking UI to select which keys to include in the configuration.

Version Management

When app versions change, identifiers may become outdated. The SDK can traverse the view hierarchy, generate identifiers for all current UI elements, and compare them with the stored configuration to mark entries as valid or obsolete, simplifying maintenance across releases.

Conclusion and Outlook

The proposed visual‑tracking solution reduces manual instrumentation while preserving the flexibility of code‑based tracking. However, challenges remain in handling conditional events, data payload logic, and large‑scale version management. Continued research is expected to further automate and streamline event tracking in mobile applications.

SDKiOSautomationvisual trackingevent trackingmobile analytics
JD Tech
Written by

JD Tech

Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.

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.