What Is Event Tracking (埋点) and Its Implementation in a Data Analysis System
This article explains the concept of event tracking (埋点), its importance for capturing user behavior, outlines the four‑module architecture of a tracking system, compares code‑based, visual and full tracking methods, describes data models, storage, management, and presents a practical case study with analysis techniques.
What Is Event Tracking
Event tracking (埋点) is the practice of embedding anchors at fixed points to capture, process, and push user behavior and events, forming a cornerstone of internet data collection and analysis.
Why Use Event Tracking
Typical website data stored in databases are business data (e.g., product listings, orders). User behavior is not stored as business data, yet it is essential for personalization and product improvement. Reasons for tracking include:
User behavior is complex and diverse, ranging from page visits and clicks to mouse movements and screen swipes, making definition and collection challenging.
The volume of behavior data is massive; a medium‑size company can generate billions of log entries per day.
Business functions do not directly depend on behavior data, but behavior insights guide personalized services and product optimization.
As a company scales, concrete needs arise, such as measuring the effectiveness of a Q&A module, counting visitors versus purchasers, and evaluating feature optimizations. These needs drive the adoption of a dedicated event‑tracking analysis system.
Our System Overview
Overall Structure
A typical event‑tracking system consists of four modules:
Tracking SDK: collects user actions and reports them.
Data Storage: receives reports, filters and parses required fields, performs basic cleaning, and persists them.
Data Analysis: transforms raw events into understandable metrics.
Visualization Platform: provides rich dashboards based on various dimensions.
Tracking Methods
Tracking can be performed on the front‑end (client) or back‑end (server). Front‑end tracking includes code‑based, visual, and full (auto) tracking.
Code‑Based
Visual
Full (Auto)
Advantages
Selective collection; richer business information; focused analysis.
Configuration‑driven collection of selected UI controls; “no‑tracking” collects everything first, then filters.
Similar to visual, but collects all interactions first and filters later.
Disadvantages
Higher development effort.
Limited coverage; not all UI controls can be customized.
Lower data accuracy; high upload volume; limited dimensions (click, load, refresh).
Collection Method
Embed SDK, define timestamps, add event code.
Embed SDK, visually select time windows.
Embed SDK.
Typical Vendors
Umeng, Youzan, TalkingData.
Mixpanel, Sensors, ZhugeIO.
Youzan, Heap, GrowingIO.
Vendor Focus
Business‑value‑driven behavior analysis.
Shallow application; many pages, few elements.
No need to pre‑define events; suitable for landing pages and key experiences.
Given limited development resources, we chose a code‑based (intrusive) tracking approach and built an automated component insertion tool handled by front‑end engineers.
Tracking Model
Most industry solutions use an event model (or variant) that captures five elements: Who, When, Where, How, and What.
Who: user and device identity.
When: timestamp of the event.
How: the state or type of the event.
Where: precise location of the event.
What: business‑specific content captured at the event.
In our implementation, data revolves around two themes: Event and User. For events we collect type, time, page position, etc.; for users we collect IP, OS, browser, screen resolution, and generate a unique identifier stored in a cookie.
bdata: {}, // business data
createTime: "1571038815128", // creation time
evt: "browse", // event type
ipAddr: 122.226.174.195, // IP address
logType: 2, // trigger type
lver: 1.1.0, // version
mx: 0, // x coordinate
my: 0, // y coordinate
os: "Windows/7", // operating system
pre: "https://www.xxx.cn/", // referrer URL
scr: "1920x1360", // screen resolution
url: "https://www.xxx.cn/", // page URL
userId: "001", // user identifier
utmCnt: "a0004.2ef5001f.0001.0001.d814bf60ee5511e99397b37fe9083257", // position code
utmUrl: "a0004.2ef5001f.0001.0001", // source code
uuid: "d7fd8de0-ee55-11e9-9397-b37fe9083257" // browser UUIDUTM Code Explanation
A: site or business identifier (e.g., iOS, mini‑program).
B: page.
C: page section.
D: sub‑section position.
E: unique request identifier for a session or click.
Tracking Management
When a company is small, spreadsheets may suffice, but as the number of tracked points grows to thousands, a dedicated management platform becomes essential. Such a platform stores metadata, enforces permissions, and prevents chaotic tracking.
Metadata management and open APIs.
Tracking workflow management (future).
Data Storage
We store raw tracking data in Alibaba Cloud LOG Service, which offers real‑time consumption APIs, rich query capabilities, and the ability to add real‑time indexes.
Linkage Practice – Service Window Tracking Case
Background
To analyze detailed user journeys (e.g., how a user reaches a product page), we need to stitch together logs from multiple pages into a coherent path.
Tracking Path
The user flow consists of four steps: homepage → product list → product detail → order confirmation. We collect automatic page‑enter/exit events, button click events, and link click events on each page.
Linkage Explanation
The fields utmCnt and utmUrl identify the event location and enable chaining of user actions across pages.
Table Structure
Field Code
Field Name
operator_id
User ID
utm_pre
Referrer URL
utm_cnt
Current URL
evt_type
Custom event type
log_type
Page event type
count
Count
server_id
Service product ID
pt
Date (day granularity)
Data Analysis
Single‑Page Analysis
From raw event data we can derive many dimensions for a single page, such as page views, unique visitors, and interaction metrics.
Path Analysis
Unordered funnel: count UV entering the product list as step 1, clicks opening product details as step 2, etc., then compute conversion percentages between steps. Ordered funnel: filter users who follow the exact sequence, ensuring percentages never exceed 100%.
Open Questions
How to identify page‑back actions and calculate conversion rates?
How to handle URL redirects (301/302) in the linkage parameters?
How to trace the original purchase path when users add items to cart before ordering?
Thoughts
Many similar challenges arise when consolidating user‑behavior logs into coherent paths. While individual technical solutions exist, building a generic, scalable framework remains a long‑term effort.
Future Actions
Build a tracking test system that provides automated testing to support rapid integration of event tracking.
政采云技术
ZCY Technology Team (Zero), based in Hangzhou, is a growth-oriented team passionate about technology and craftsmanship. With around 500 members, we are building comprehensive engineering, project management, and talent development systems. We are committed to innovation and creating a cloud service ecosystem for government and enterprise procurement. We look forward to your joining us.
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.