# A single tracking question can reveal three years of experience

Date: 2025-05-29
Category: Interview Preparation
Tags: Data Products, Event Tracking, Interviews
Summary: Designing analytics events for the favorites feature looks like listing fields, but what it really tests is how to define the denominator, how to separate intent from outcome, idempotent deduplication, and field governance. Attached at the end is an event dictionary I would write directly into the answer.

I often open with a very small question: design analytics events for the favorite feature of a content app, so that "favorite rate" and "post-favorite revisit rate" can be calculated.

Candidates usually start listing field names right away: `user_id`, `content_id`, `event_time`, and by the fourth one they get stuck. This isn't a memory problem—it's that they haven't realized the deliverable of an event-tracking plan isn't a field table, but a definition of "what counts as one occurrence." People who've done this for a while will first ask back: what's the denominator of the favorite rate?

> Post 2/10 in this series · [Previous: The metric went up—why I don't count it as an improvement](/2026/05/14/data-pm-interview-metric-definition/) · [Next: Data dropped 30%—don't rush to attribute it to the business](/2026/10/04/data-pm-interview-anomaly-triage/)

## The denominator is harder to define than the numerator

"Favorite rate = favorites / impressions"—the least reliable part of this sentence is the denominator.

What counts as a valid impression? Does a card swiped past in the list count, does half-visible count, does staying on screen for less than a second count, does the same card swiped back and forth three times count as three? If these rules aren't fixed, each client writes its own: iOS reports 3, Android reports 1, and the difference in favorite rate on the report is purely a client implementation difference, unrelated to whether users like the content.

I generally require a testable rule: visible area over half, dwell time over one second, the same content counted only once per session, and the way "session" is cut (e.g., 30 minutes of inactivity) written into the dictionary as well. The threshold value is negotiable, but you have to state what happens when it moves—loosen it, the impression denominator grows and the favorite rate is diluted; tighten it, the reverse.

Who you pick as the denominator is itself a product judgment. Using impressions as the denominator asks "how many of the people who saw it favorited it," measuring the content's own appeal; switching to detail-page UV as the denominator asks "how many of the people who clicked in favorited it," measuring whether the content delivers on its title. Both numbers are called favorite rate, but their meanings are far apart—this is where cross-team comparisons most easily clash. So the dictionary needs, besides the formula, a sentence on who this metric serves and what decision it supports.

## The numerator needs at least two layers

A user tapping the favorite button is intent; the server writing the relationship into the favorites table is the result. The stretch in between often breaks: network timeout, content taken down, login state expired and a login dialog pops up, button double-tapped.

Tracking only the front-end click means the favorite rate counts failures and cancellations as successes; tracking only the server-side write means you can't see how many people got stuck at the login dialog. So at least four events, two on the client and two on the server.

| Event | Triggered by | Timing | Key properties |
| --- | --- | --- | --- |
| `content_exposure` | Client | Valid impression conditions met | content_id, position, list type, experiment group |
| `favorite_click` | Client | Favorite button tapped | content_id, current favorite state, source slot |
| `favorite_success` | Server | Relationship successfully written | content_id, user_id, write time |
| `favorite_remove` | Server | Unfavorite succeeded | content_id, user_id, reason for unfavoriting (if available) |

The gap between the click count and the write count is itself a metric: failure rate. Engineering fixes it, but product needs to watch it. When this number goes from 1% to 5%, it means every release is quietly swallowing users' favorites—invisible on the report, and users won't complain; they'll just find that content missing next time and think the app is hard to use.

"Post-favorite revisit rate" also needs a behavior event: the user opens this content again within the following N days. What's most easily missed here is the attribution window—7 days or 30 days, counted from the moment of favoriting or from midnight the next day, and whether "revisit" means opening the detail page or any content consumption. Without a fixed window, the numbers reported in two quarters can't be compared, and you can't explain to the business side why the revisit rate "improved" this time.

## What a workable event dictionary looks like

Beyond event names, properties, and timing, I require the answer to include the following fields—miss one and I ask one more question.

```json
{
  "event": "favorite_click",
  "event_id": "客户端生成的 UUID，用于全链路去重",
  "user_id": "登录后 ID，为空时填 anonymous_id",
  "anonymous_id": "设备级匿名 ID",
  "session_id": "按 30 分钟不活动切分",
  "event_time": "客户端发生时间，毫秒",
  "recv_time": "服务端接收时间，用于判断延迟与补报",
  "props": {
    "content_id": "内容 ID",
    "position": "列表位置",
    "from": "信息流 / 详情页 / 搜索",
    "exp_group": "曝光时刻的实验分组快照"
  },
  "common": {
    "app_version": "客户端版本",
    "os": "系统",
    "channel": "渠道",
    "network": "网络类型"
  }
}
```

Three details deserve separate mention.

Idempotency. To avoid losing data, the client caches and retries, so on a weak network the same event may be reported twice; offline backfill also brings data where `event_time` and `recv_time` differ by several hours. So there must be a stable `event_id` for the server to deduplicate on, and the computation side agrees to assign days by `event_time` and judge the late-arrival window by `recv_time`. Confuse these two times and backfilling historical partitions will definitely go wrong.

Experiment group must be snapshotted. Many people leave `exp_group` empty, planning to join the user's current group at analysis time. But the user may have been re-bucketed midway, or the experiment may have long ended, and the group joined after the fact isn't the same as at impression time at all. The group must be written in at the moment the event occurs.

Common properties pushed down. If fields like version, platform, and channel are defined separately by each business event, three months later there will be three spellings—`app_ver`, `version`, `clientVersion`—and no one can say which is correct. They should be injected uniformly by the SDK, and business folks fill in only business properties.

## How to verify before launch

Once the plan is written, I ask one last question: how do you know it actually works.

Anyone who answers only "check whether there are logs in the console" probably hasn't been through a full event-tracking launch. My approach is to take a real device, walk from impression to write, and print out every event along the chain field by field to check, including exiting and re-entering, retrying with the network off, switching accounts, and content being taken down. Then do a reconciliation: compare the number of `favorite_success` reported by the front end with the number of rows added to the server's favorites table that day, and compute the reporting rate. If they don't match, don't ship the report yet. An event-tracking setup that quietly drops 5% of events is more dangerous than none at all, because no one will suspect it.

Many people find this step dumb, but it's the only way to verify that "definition" and "implementation" agree. However beautifully the plan is written, if one `session_id` is missing at implementation, the session-deduplicated impression definition collapses—and it collapses with no error at all.

## Event tracking is an interface, not a log

One layer further out is governance. The event dictionary needs an owner, field types, required-field validation, and a version number; new fields can be added, existing fields must not have their semantics quietly changed—if you need a change, create a new field and keep the old one until its lineage is cleaned up before retiring it.

The most expensive mistake I've seen was someone changing `position` from "list index" to "channel ID" without telling anyone, so every funnel analysis by position from that moment on was wrong—and no error was ever raised. By the time the business side noticed the recommendation slot's performance "suddenly got worse," two releases had passed.

People who can proactively bring up unfavoriting, content takedown, and backfill deduplication in an interview have mostly been burned by this data for real.

As for the business side saying "just instrument every click," I usually ask back: what question will this one event answer in the future? If they can't answer, it doesn't get instrumented. More tracking isn't better—it's an interface that has to be maintained long-term, and every extra field is one more piece of debt no one will dare delete later.

When is this dictionary considered done? Not the moment the fields are filled in, but the moment I can clearly explain every event's failure modes in a review meeting.
